File tree 1 file changed +5
-2
lines changed
Filter options
src/Symfony/Component/Messenger
1 file changed +5
-2
lines changed
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ public function run(array $options = []): void
87
87
88
88
while (false === $ this ->shouldStop ) {
89
89
$ envelopeHandled = false ;
90
+ $ envelopeHandledStart = microtime (true );
90
91
foreach ($ this ->receivers as $ transportName => $ receiver ) {
91
92
if ($ queueNames ) {
92
93
$ envelopes = $ receiver ->getFromQueues ($ queueNames );
@@ -113,10 +114,12 @@ public function run(array $options = []): void
113
114
}
114
115
}
115
116
116
- if (false === $ envelopeHandled ) {
117
+ if (! $ envelopeHandled ) {
117
118
$ this ->dispatchEvent (new WorkerRunningEvent ($ this , true ));
118
119
119
- usleep ($ options ['sleep ' ]);
120
+ if (0 < $ sleep = (int ) ($ options ['sleep ' ] - 1e6 * (microtime (true ) - $ envelopeHandledStart ))) {
121
+ usleep ($ sleep );
122
+ }
120
123
}
121
124
}
122
125
You can’t perform that action at this time.
0 commit comments