mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
fix(db): Atomically was not resolving with a value, fixes mail notifications
This commit is contained in:
parent
a35416ae94
commit
42f65798d6
1 changed files with 6 additions and 4 deletions
|
@ -462,15 +462,17 @@ class DatabaseStore extends NylasStore
|
||||||
|
|
||||||
atomically: (fn) =>
|
atomically: (fn) =>
|
||||||
@_atomicPromise ?= Promise.resolve()
|
@_atomicPromise ?= Promise.resolve()
|
||||||
@_atomicPromise = @_atomicPromise.finally =>
|
@_atomicPromise = @_atomicPromise.then =>
|
||||||
@_atomically(fn)
|
@_atomically(fn)
|
||||||
return @_atomicPromise
|
return @_atomicPromise
|
||||||
|
|
||||||
_atomically: (fn) ->
|
_atomically: (fn) ->
|
||||||
@_query("BEGIN EXCLUSIVE TRANSACTION")
|
@_query("BEGIN EXCLUSIVE TRANSACTION")
|
||||||
.then => fn()
|
.then =>
|
||||||
.then => @_query("COMMIT")
|
fn()
|
||||||
.then => Promise.resolve()
|
.then (val) =>
|
||||||
|
@_query("COMMIT").then =>
|
||||||
|
Promise.resolve(val)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
########################### PRIVATE METHODS ############################
|
########################### PRIVATE METHODS ############################
|
||||||
|
|
Loading…
Reference in a new issue