Skip to content

Commit f9caf10

Browse files
committed
Fix queue processing timeout
1 parent 2921f5b commit f9caf10

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Queue/Adapters/QueueAdapter.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ public function sleep(int $seconds): void
103103
/**
104104
* Update the processing timeout
105105
*
106+
* @param int $timeout
106107
* @return void
107108
*/
108-
public function updateProcessingTimeout(): void
109+
public function updateProcessingTimeout(int $timeout = 60): void
109110
{
110-
$this->processing_timeout = time();
111+
$this->processing_timeout = time() + $timeout;
111112
}
112113

113114
/**
@@ -119,15 +120,15 @@ public function updateProcessingTimeout(): void
119120
*/
120121
final public function work(int $timeout, int $memory): void
121122
{
122-
[$this->processing_timeout, $jobs_processed] = [time(), 0];
123+
[$this->processing_timeout, $jobs_processed] = [time() + $timeout, 0];
123124

124125
if ($this->supportsAsyncSignals()) {
125126
$this->listenForSignals();
126127
}
127128

128129
while (true) {
129130
try {
130-
$this->updateProcessingTimeout();
131+
$this->updateProcessingTimeout($timeout);
131132
$this->run($this->queue);
132133
} finally {
133134
$this->sleep($this->sleep);

0 commit comments

Comments
 (0)