mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-04 07:10:06 +08:00
fix(retry): When tasks fail, try fewer times: 2s, 4s, 8s, 16s, 30s
This commit is contained in:
parent
5722847208
commit
17b474c14f
2 changed files with 3 additions and 3 deletions
|
@ -236,7 +236,7 @@ describe "TaskQueue", ->
|
|||
TaskQueue._processTask(task)
|
||||
advanceClock()
|
||||
expect(task.queueState.retryAfter).toBeDefined()
|
||||
expect(task.queueState.retryDelay).toEqual(1000 * 1.2)
|
||||
expect(task.queueState.retryDelay).toEqual(1000 * 2)
|
||||
|
||||
it "increases retryDelay", ->
|
||||
task = @retryTaskWith({retryAfter: Date.now() - 1000, retryDelay: 2000})
|
||||
|
@ -244,7 +244,7 @@ describe "TaskQueue", ->
|
|||
TaskQueue._processTask(task)
|
||||
advanceClock()
|
||||
expect(task.queueState.retryAfter).toBeDefined()
|
||||
expect(task.queueState.retryDelay).toEqual(2000 * 1.2)
|
||||
expect(task.queueState.retryDelay).toEqual(2000 * 2)
|
||||
|
||||
it "caps retryDelay", ->
|
||||
task = @retryTaskWith({retryAfter: Date.now() - 1000, retryDelay: 30000})
|
||||
|
|
|
@ -208,7 +208,7 @@ class TaskQueue
|
|||
@trigger()
|
||||
.then (status) =>
|
||||
if status is Task.Status.Retry
|
||||
task.queueState.retryDelay = Math.round(Math.min((task.queueState.retryDelay ? 1000) * 1.2, 30000))
|
||||
task.queueState.retryDelay = Math.round(Math.min((task.queueState.retryDelay ? 1000) * 2, 30000))
|
||||
task.queueState.retryAfter = Date.now() + task.queueState.retryDelay
|
||||
else
|
||||
@dequeue(task)
|
||||
|
|
Loading…
Reference in a new issue