mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-28 18:14:08 +08:00
perf(delta-sync): Don't update work UI when window is hidden, don't save config as often (synchronous IPC)
This commit is contained in:
parent
8b236fde67
commit
94973cc980
2 changed files with 9 additions and 7 deletions
|
@ -23,8 +23,15 @@ class NylasLongConnection
|
||||||
|
|
||||||
@_deltas = []
|
@_deltas = []
|
||||||
@_flushDeltasDebounced = _.debounce =>
|
@_flushDeltasDebounced = _.debounce =>
|
||||||
|
|
||||||
|
return if @_deltas.length is 0
|
||||||
|
last = @_deltas[@_deltas.length - 1]
|
||||||
|
|
||||||
@_emitter.emit('deltas-stopped-arriving', @_deltas)
|
@_emitter.emit('deltas-stopped-arriving', @_deltas)
|
||||||
@_deltas = []
|
@_deltas = []
|
||||||
|
|
||||||
|
# Note: setCursor is slow and saves to disk, so we do it once at the end
|
||||||
|
@setCursor(last.cursor)
|
||||||
, 1000
|
, 1000
|
||||||
|
|
||||||
@
|
@
|
||||||
|
@ -69,7 +76,6 @@ class NylasLongConnection
|
||||||
|
|
||||||
onProcessBuffer: =>
|
onProcessBuffer: =>
|
||||||
bufferJSONs = @_buffer.split('\n')
|
bufferJSONs = @_buffer.split('\n')
|
||||||
bufferCursor = null
|
|
||||||
|
|
||||||
# We can't parse the last block - we don't know whether we've
|
# We can't parse the last block - we don't know whether we've
|
||||||
# received the entire delta or only part of it. Wait
|
# received the entire delta or only part of it. Wait
|
||||||
|
@ -87,11 +93,6 @@ class NylasLongConnection
|
||||||
throw (new Error 'Received delta with no cursor!') unless delta.cursor
|
throw (new Error 'Received delta with no cursor!') unless delta.cursor
|
||||||
@_deltas.push(delta)
|
@_deltas.push(delta)
|
||||||
@_flushDeltasDebounced()
|
@_flushDeltasDebounced()
|
||||||
bufferCursor = delta.cursor
|
|
||||||
|
|
||||||
# Note: setCursor is slow and saves to disk, so we do it once at the end
|
|
||||||
if bufferCursor
|
|
||||||
@setCursor(bufferCursor)
|
|
||||||
|
|
||||||
start: ->
|
start: ->
|
||||||
token = @_api.accessTokenForAccountId(@_accountId)
|
token = @_api.accessTokenForAccountId(@_accountId)
|
||||||
|
|
|
@ -27,7 +27,8 @@ class DeveloperBarStore extends NylasStore
|
||||||
|
|
||||||
triggerThrottled: ->
|
triggerThrottled: ->
|
||||||
@_triggerThrottled ?= _.throttle(@trigger, 100)
|
@_triggerThrottled ?= _.throttle(@trigger, 100)
|
||||||
@_triggerThrottled()
|
if atom.getCurrentWindow().isVisible()
|
||||||
|
@_triggerThrottled()
|
||||||
|
|
||||||
_setStoreDefaults: ->
|
_setStoreDefaults: ->
|
||||||
@_curlHistory = {}
|
@_curlHistory = {}
|
||||||
|
|
Loading…
Reference in a new issue