mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +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'
|
||||
DatabaseStore = require '../../src/flux/stores/database-store'
|
||||
TaskQueue = require '../../src/flux/stores/task-queue'
|
||||
Task = require '../../src/flux/tasks/task'
|
||||
|
||||
|
@ -30,6 +31,18 @@ describe "TaskQueue", ->
|
|||
# Flush any throttled or debounced updates
|
||||
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", ->
|
||||
beforeEach ->
|
||||
@subclassA = new TaskSubclassA()
|
||||
|
|
|
@ -213,6 +213,7 @@ class TaskQueue
|
|||
task.queueState ?= {}
|
||||
task.queueState.isProcessing = false
|
||||
@_queue = queue
|
||||
@_processQueue()
|
||||
|
||||
_updateSoon: =>
|
||||
@_updateSoonThrottled ?= _.throttle =>
|
||||
|
|
Loading…
Reference in a new issue