This commit is contained in:
2020-10-09 18:34:33 +08:00
parent c7f6f810cd
commit 10e0bdc93b
+4 -5
View File
@@ -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);
});
}
// }}}