diff --git a/Kafka/Consumer/State.php b/Kafka/Consumer/State.php index b49590ab..a61371f3 100644 --- a/Kafka/Consumer/State.php +++ b/Kafka/Consumer/State.php @@ -15,7 +15,6 @@ namespace Kafka\Consumer; use Swoole\Timer; -use function Amp\repeat; /** * +------------------------------------------------------------------------------ @@ -137,13 +136,13 @@ class State continue; } $interval = isset($option['interval']) ? $option['interval'] : 200; - repeat(function ($watcherId) use ($request, $option) { + Timer::tick($msInterval = $interval, function ($watcherId) use ($request, $option) { if ($this->checkRun($request) && $option['func'] != null) { $context = call_user_func($option['func']); $this->processing($request, $context); } $this->requests[$request]['watcher'] = $watcherId; - }, $msInterval = $interval); + }); } // start sync metadata @@ -151,9 +150,9 @@ class State $context = call_user_func($this->requests[self::REQUEST_METADATA]['func']); $this->processing($request, $context); } - repeat(function ($watcherId) { + Timer::tick($msInterval = 1000, function ($watcherId) { $this->report(); - }, $msInterval = 1000); + }); } // }}}