Skip to content

Commit d961a5d

Browse files
committed
fix(Jobs): Fix ReportExceptionJob timeout and retryAfter values
- Updated 'timeout' value to 30 seconds - Updated 'retryAfter' value to 300 seconds
1 parent 873df00 commit d961a5d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

config/exception-notify.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
'job' => [
4848
'connection' => env('EXCEPTION_NOTIFY_JOB_CONNECTION', config('queue.default', 'sync')),
4949
'queue' => env('EXCEPTION_NOTIFY_JOB_QUEUE'),
50+
'tries' => (int) env('EXCEPTION_NOTIFY_JOB_TRIES', 1),
51+
'timeout' => (int) env('EXCEPTION_NOTIFY_JOB_QUEUE_TIMEOUT', 30),
52+
'retry_after' => (int) env('EXCEPTION_NOTIFY_JOB_QUEUE_RETRY_AFTER', 300),
5053
],
5154

5255
/**

src/Jobs/ReportExceptionJob.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ class ReportExceptionJob implements ShouldQueue
3333
*/
3434
public int $tries = 1;
3535

36+
/**
37+
* 在超时之前任务可以运行的秒数
38+
*/
39+
public int $timeout = 30;
40+
41+
/**
42+
* 重试任务前等待的秒数
43+
*/
44+
public int $retryAfter = 300;
45+
3646
/**
3747
* @var array<string, string>
3848
*/
@@ -49,6 +59,18 @@ public function __construct(array $reports)
4959
if ($queue = config('exception-notify.job.queue')) {
5060
$this->onQueue($queue);
5161
}
62+
63+
if ($tries = config('exception-notify.job.tries')) {
64+
$this->tries = $tries;
65+
}
66+
67+
if ($timeout = config('exception-notify.job.timeout')) {
68+
$this->timeout = $timeout;
69+
}
70+
71+
if ($retryAfter = config('exception-notify.job.retry_after')) {
72+
$this->retryAfter = $retryAfter;
73+
}
5274
}
5375

5476
/**

0 commit comments

Comments
 (0)