File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public function await(callable $callback): void
5454 protected function listen (callable $ callback , CarbonInterface $ ttl ): void
5555 {
5656 // Iterate over responses yielded by the idle generator.
57- foreach ($ this ->idle () as $ response ) {
57+ foreach ($ this ->idle ($ ttl ) as $ response ) {
5858 if (! $ response instanceof UntaggedResponse) {
5959 continue ;
6060 }
@@ -67,6 +67,10 @@ protected function listen(callable $callback, CarbonInterface $ttl): void
6767 $ ttl = $ this ->getNextTimeout ();
6868 }
6969
70+ if ($ ttl === false ) {
71+ break ;
72+ }
73+
7074 // If we've been idle too long, break out to restart the session.
7175 if (Carbon::now ()->greaterThanOrEqualTo ($ ttl )) {
7276 $ this ->restart ();
@@ -143,9 +147,11 @@ protected function done(): void
143147 /**
144148 * Begin a new IDLE session as a generator.
145149 */
146- protected function idle (): Generator
150+ protected function idle (CarbonInterface $ ttl ): Generator
147151 {
148- yield from $ this ->mailbox ->connection ()->idle ($ this ->timeout );
152+ yield from $ this ->mailbox ->connection ()->idle (
153+ (int ) Carbon::now ()->diffInSeconds ($ ttl )
154+ );
149155 }
150156
151157 /**
You can’t perform that action at this time.
0 commit comments