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:
Evan Morikawa 2015-10-28 19:51:46 -04:00
parent e0180a1e12
commit 1febd56ed5
2 changed files with 3 additions and 3 deletions

View file

@ -41,11 +41,11 @@ describe "DraftChangeSet", ->
expect(@changeSet.commit).toHaveBeenCalled()
describe "otherwise", ->
it "should commit after five seconds", ->
it "should commit after thirty seconds", ->
spyOn(@changeSet, 'commit')
@changeSet.add({body: 'Hello World!'})
expect(@changeSet.commit).not.toHaveBeenCalled()
advanceClock(6000)
advanceClock(31000)
expect(@changeSet.commit).toHaveBeenCalled()
describe "commit", ->

View file

@ -44,7 +44,7 @@ class DraftChangeSet
@commit()
else
clearTimeout(@_timer) if @_timer
@_timer = setTimeout(@commit, 5000)
@_timer = setTimeout(@commit, 30000)
# If force is true, then we'll always run the `_onCommit` callback
# regardless if there are _pending changes or not