Add time parameter to listen function

This commit is contained in:
veselcraft 2022-09-19 17:09:27 +03:00
parent e3706234e7
commit b4e1798992
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -64,10 +64,10 @@ class SignalManager
* @uses \Chandler\Signaling\SignalManager::eventFor * @uses \Chandler\Signaling\SignalManager::eventFor
* @return void * @return void
*/ */
function listen(\Closure $callback, int $for): void function listen(\Closure $callback, int $for, int $time = 25): void
{ {
$this->since = time() - 1; $this->since = time() - 1;
for($i = 0; $i < 25; $i++) { for($i = 0; $i < $time; $i++) {
sleep(1); sleep(1);
$event = $this->eventFor($for); $event = $this->eventFor($for);