mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
fix(db): remove db temp files as well
This commit is contained in:
parent
7126d708ca
commit
f8cb9a81eb
2 changed files with 9 additions and 3 deletions
|
@ -131,6 +131,7 @@ class Application
|
|||
# exit and then delete the file. It's hard to tell when this happens, so we just
|
||||
# retry the deletion a few times.
|
||||
deleteFileWithRetry: (filePath, callback, retries = 5) ->
|
||||
callback ?= ->
|
||||
callbackWithRetry = (err) =>
|
||||
if err and err.message.indexOf('no such file') is -1
|
||||
console.log("File Error: #{err.message} - retrying in 150msec")
|
||||
|
@ -163,13 +164,18 @@ class Application
|
|||
_logout: =>
|
||||
@setDatabasePhase('close')
|
||||
@windowManager.closeAllWindows()
|
||||
@deleteFileWithRetry path.join(configDirPath,'edgehill.db'), =>
|
||||
@_deleteDatabase =>
|
||||
@config.set('tokens', null)
|
||||
@config.set('nylas', null)
|
||||
@config.set('edgehill', null)
|
||||
@setDatabasePhase('setup')
|
||||
@openWindowsForTokenState()
|
||||
|
||||
_deleteDatabase: (callback) ->
|
||||
@deleteFileWithRetry path.join(configDirPath,'edgehill.db'), callback
|
||||
@deleteFileWithRetry path.join(configDirPath,'edgehill.db-wal')
|
||||
@deleteFileWithRetry path.join(configDirPath,'edgehill.db-shm')
|
||||
|
||||
_loginSuccessful: =>
|
||||
@openWindowsForTokenState()
|
||||
@windowManager.mainWindow().waitForLoad =>
|
||||
|
@ -203,7 +209,7 @@ class Application
|
|||
detail: 'Welcome back to Nylas! We need to rebuild your mailbox to support new features. Please wait a few moments while we re-sync your mail.'
|
||||
buttons: ['OK']
|
||||
|
||||
@deleteFileWithRetry path.join(configDirPath,'edgehill.db'), =>
|
||||
@_deleteDatabase =>
|
||||
@setDatabasePhase('setup')
|
||||
@openWindowsForTokenState()
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ PriorityUICoordinator = require '../../priority-ui-coordinator'
|
|||
serializeRegisteredObjects,
|
||||
deserializeRegisteredObjects} = require '../models/utils'
|
||||
|
||||
DatabaseVersion = 13
|
||||
DatabaseVersion = 14
|
||||
|
||||
DatabasePhase =
|
||||
Setup: 'setup'
|
||||
|
|
Loading…
Reference in a new issue