改名
This commit is contained in:
@@ -17,16 +17,5 @@ interface PipeMessage
|
|||||||
public function process(): void;
|
public function process(): void;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function max_execute(): void;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isStop(): bool;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use Swoole\Timer;
|
|||||||
* @package Snowflake
|
* @package Snowflake
|
||||||
* @property Application $application
|
* @property Application $application
|
||||||
*/
|
*/
|
||||||
abstract class Crontab implements PipeMessage
|
abstract class Crontab implements PipeMessage, CrontabInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
const WAIT_END = 'crontab:wait:execute';
|
const WAIT_END = 'crontab:wait:execute';
|
||||||
@@ -247,7 +247,7 @@ abstract class Crontab implements PipeMessage
|
|||||||
if (!$this->isMaxExecute()) {
|
if (!$this->isMaxExecute()) {
|
||||||
return 999;
|
return 999;
|
||||||
}
|
}
|
||||||
call_user_func([$this, 'max_execute']);
|
call_user_func([$this, 'onMaxExecute']);
|
||||||
return $redis->del('crontab:' . $crontab_name);
|
return $redis->del('crontab:' . $crontab_name);
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
return $this->application->addError($throwable, 'throwable');
|
return $this->application->addError($throwable, 'throwable');
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Snowflake\Crontab;
|
||||||
|
|
||||||
|
interface CrontabInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function onMaxExecute(): void;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isStop(): bool;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ class DefaultCrontab extends Crontab
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function max_execute(): void
|
public function onMaxExecute(): void
|
||||||
{
|
{
|
||||||
// TODO: Implement max_execute() method.
|
// TODO: Implement max_execute() method.
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user