|
9 | 9 | use Interop\Amqp\AmqpConsumer; |
10 | 10 | use Illuminate\Queue\Jobs\JobName; |
11 | 11 | use Illuminate\Container\Container; |
12 | | -use Illuminate\Database\DetectsDeadlocks; |
| 12 | +use Illuminate\Database\DetectsLostConnections; |
13 | 13 | use Illuminate\Contracts\Queue\Job as JobContract; |
14 | 14 | use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue; |
15 | 15 | use VladimirYuldashev\LaravelQueueRabbitMQ\Horizon\RabbitMQQueue as HorizonRabbitMQQueue; |
16 | 16 |
|
17 | 17 | class RabbitMQJob extends Job implements JobContract |
18 | 18 | { |
19 | | - use DetectsDeadlocks; |
| 19 | + use DetectsLostConnections; |
20 | 20 |
|
21 | 21 | /** |
22 | 22 | * Same as RabbitMQQueue, used for attempt counts. |
@@ -58,7 +58,7 @@ public function fire(): void |
58 | 58 | with($this->instance = $this->resolve($class))->{$method}($this, $payload['data']); |
59 | 59 | } catch (Exception $exception) { |
60 | 60 | if ( |
61 | | - $this->causedByDeadlock($exception) || |
| 61 | + $this->causedByLostConnection($exception) || |
62 | 62 | Str::contains($exception->getMessage(), ['detected deadlock']) |
63 | 63 | ) { |
64 | 64 | sleep(2); |
@@ -136,7 +136,6 @@ public function release($delay = 0): void |
136 | 136 | * Get the job identifier. |
137 | 137 | * |
138 | 138 | * @return string |
139 | | - * @throws \Interop\Queue\Exception |
140 | 139 | */ |
141 | 140 | public function getJobId(): string |
142 | 141 | { |
@@ -171,7 +170,7 @@ protected function unserialize(array $body) |
171 | 170 | return unserialize($body['data']['command']); |
172 | 171 | } catch (Exception $exception) { |
173 | 172 | if ( |
174 | | - $this->causedByDeadlock($exception) || |
| 173 | + $this->causedByLostConnection($exception) || |
175 | 174 | Str::contains($exception->getMessage(), ['detected deadlock']) |
176 | 175 | ) { |
177 | 176 | sleep(2); |
|
0 commit comments