fix(composer): Prevent composers in different windows to be out of sync

- Increase arbitrary wait time before closing window so Database ipc
messages can reach other windows with a higer success rate -- this
caused composers in different windows to be out of sync fairly often because the
database trigger event never reached them
- Clears commit timeout when commiting
This commit is contained in:
Juan Tejada 2016-06-08 16:54:29 -07:00
parent 3b21982af2
commit b427949288
2 changed files with 3 additions and 2 deletions

View file

@ -137,8 +137,8 @@ class ActionBridge
# Electron won't actually send the message. To work around this, we wait an
# arbitrary amount of time before closing the window after the last IPC event
# was sent. https://github.com/atom/electron/issues/4366
if @ipcLastSendTime and Date.now() - @ipcLastSendTime < 50
setTimeout(readyToUnload, 50)
if @ipcLastSendTime and Date.now() - @ipcLastSendTime < 100
setTimeout(readyToUnload, 100)
return false
return true

View file

@ -61,6 +61,7 @@ class DraftChangeSet
@add(changes, {doesNotAffectPristine: true})
commit: ({noSyncback}={}) =>
clearTimeout(@_timer) if @_timer
@_commitChain = @_commitChain.finally =>
if Object.keys(@_pending).length is 0
return Promise.resolve(true)