Skip to content

Commit

Permalink
Update Timer.php
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor authored Jun 13, 2022
1 parent bb7079b commit 7d54267
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Timer.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public static function add($time_interval, $func, $args = array(), $persistent =
return self::$_event->add($time_interval,
$persistent ? EventInterface::EV_TIMER : EventInterface::EV_TIMER_ONCE, $func, $args);
}

// If not workerman runtime just return.
if (!Worker::getAllWorkers()) {
throw new \Exception();
return;
}

if (!\is_callable($func)) {
Worker::safeEcho(new Exception("not callable"));
Expand Down

0 comments on commit 7d54267

Please sign in to comment.