mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 15:46:28 +08:00
fix(task-queue): After restoring the queue at launch, start processing tasks
This commit is contained in:
parent
0818af0279
commit
174d4ecdc1
2 changed files with 14 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
Actions = require '../../src/flux/actions'
|
Actions = require '../../src/flux/actions'
|
||||||
|
DatabaseStore = require '../../src/flux/stores/database-store'
|
||||||
TaskQueue = require '../../src/flux/stores/task-queue'
|
TaskQueue = require '../../src/flux/stores/task-queue'
|
||||||
Task = require '../../src/flux/tasks/task'
|
Task = require '../../src/flux/tasks/task'
|
||||||
|
|
||||||
|
@ -30,6 +31,18 @@ describe "TaskQueue", ->
|
||||||
# Flush any throttled or debounced updates
|
# Flush any throttled or debounced updates
|
||||||
advanceClock(1000)
|
advanceClock(1000)
|
||||||
|
|
||||||
|
describe "restoreQueue", ->
|
||||||
|
it "should fetch the queue from the database, reset flags and start processing", ->
|
||||||
|
queue = [@processingTask, @unstartedTask]
|
||||||
|
spyOn(DatabaseStore, 'findJSONObject').andCallFake => Promise.resolve(queue)
|
||||||
|
spyOn(TaskQueue, '_processQueue')
|
||||||
|
|
||||||
|
waitsForPromise =>
|
||||||
|
TaskQueue._restoreQueue().then =>
|
||||||
|
expect(TaskQueue._queue).toEqual(queue)
|
||||||
|
expect(@processingTask.queueState.isProcessing).toEqual(false)
|
||||||
|
expect(TaskQueue._processQueue).toHaveBeenCalled()
|
||||||
|
|
||||||
describe "findTask", ->
|
describe "findTask", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@subclassA = new TaskSubclassA()
|
@subclassA = new TaskSubclassA()
|
||||||
|
|
|
@ -213,6 +213,7 @@ class TaskQueue
|
||||||
task.queueState ?= {}
|
task.queueState ?= {}
|
||||||
task.queueState.isProcessing = false
|
task.queueState.isProcessing = false
|
||||||
@_queue = queue
|
@_queue = queue
|
||||||
|
@_processQueue()
|
||||||
|
|
||||||
_updateSoon: =>
|
_updateSoon: =>
|
||||||
@_updateSoonThrottled ?= _.throttle =>
|
@_updateSoonThrottled ?= _.throttle =>
|
||||||
|
|
Loading…
Reference in a new issue