This commit is contained in:
2021-08-05 16:01:51 +08:00
parent c17a1cfcc6
commit 300a016dd2
4 changed files with 23 additions and 14 deletions
-11
View File
@@ -17,16 +17,5 @@ interface PipeMessage
public function process(): void;
/**
*
*/
public function max_execute(): void;
/**
* @return bool
*/
public function isStop(): bool;
}
+2 -2
View File
@@ -16,7 +16,7 @@ use Swoole\Timer;
* @package Snowflake
* @property Application $application
*/
abstract class Crontab implements PipeMessage
abstract class Crontab implements PipeMessage, CrontabInterface
{
const WAIT_END = 'crontab:wait:execute';
@@ -247,7 +247,7 @@ abstract class Crontab implements PipeMessage
if (!$this->isMaxExecute()) {
return 999;
}
call_user_func([$this, 'max_execute']);
call_user_func([$this, 'onMaxExecute']);
return $redis->del('crontab:' . $crontab_name);
} catch (\Throwable $throwable) {
return $this->application->addError($throwable, 'throwable');
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Snowflake\Crontab;
interface CrontabInterface
{
/**
*
*/
public function onMaxExecute(): void;
/**
* @return bool
*/
public function isStop(): bool;
}
+1 -1
View File
@@ -33,7 +33,7 @@ class DefaultCrontab extends Crontab
/**
*
*/
public function max_execute(): void
public function onMaxExecute(): void
{
// TODO: Implement max_execute() method.
}