mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-27 06:54:48 +08:00
fix(drafts): only syncback every 30 seconds instead of 5 seconds
This will help prevent API errors from causing multiple drafts to appear
This commit is contained in:
parent
e0180a1e12
commit
1febd56ed5
2 changed files with 3 additions and 3 deletions
|
@ -41,11 +41,11 @@ describe "DraftChangeSet", ->
|
||||||
expect(@changeSet.commit).toHaveBeenCalled()
|
expect(@changeSet.commit).toHaveBeenCalled()
|
||||||
|
|
||||||
describe "otherwise", ->
|
describe "otherwise", ->
|
||||||
it "should commit after five seconds", ->
|
it "should commit after thirty seconds", ->
|
||||||
spyOn(@changeSet, 'commit')
|
spyOn(@changeSet, 'commit')
|
||||||
@changeSet.add({body: 'Hello World!'})
|
@changeSet.add({body: 'Hello World!'})
|
||||||
expect(@changeSet.commit).not.toHaveBeenCalled()
|
expect(@changeSet.commit).not.toHaveBeenCalled()
|
||||||
advanceClock(6000)
|
advanceClock(31000)
|
||||||
expect(@changeSet.commit).toHaveBeenCalled()
|
expect(@changeSet.commit).toHaveBeenCalled()
|
||||||
|
|
||||||
describe "commit", ->
|
describe "commit", ->
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DraftChangeSet
|
||||||
@commit()
|
@commit()
|
||||||
else
|
else
|
||||||
clearTimeout(@_timer) if @_timer
|
clearTimeout(@_timer) if @_timer
|
||||||
@_timer = setTimeout(@commit, 5000)
|
@_timer = setTimeout(@commit, 30000)
|
||||||
|
|
||||||
# If force is true, then we'll always run the `_onCommit` callback
|
# If force is true, then we'll always run the `_onCommit` callback
|
||||||
# regardless if there are _pending changes or not
|
# regardless if there are _pending changes or not
|
||||||
|
|
Loading…
Add table
Reference in a new issue