mirror of
https://github.com/danog/loop.git
synced 2024-11-26 20:04:44 +01:00
Update
This commit is contained in:
parent
c8ca407d59
commit
6adc4d5d25
@ -9,6 +9,7 @@
|
||||
|
||||
namespace danog\Loop\Generic;
|
||||
|
||||
use Amp\Promise;
|
||||
use danog\Loop\ResumableSignalLoop;
|
||||
|
||||
/**
|
||||
@ -68,7 +69,13 @@ class PeriodicLoop extends ResumableSignalLoop
|
||||
if ($result) {
|
||||
return;
|
||||
}
|
||||
yield $callback();
|
||||
/** @psalm-suppress MixedAssignment */
|
||||
$result = $callback();
|
||||
if ($result instanceof \Generator) {
|
||||
yield from $result;
|
||||
} elseif ($result instanceof Promise) {
|
||||
yield $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user