mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-20 09:06:45 +00:00
GODT-1350: stop cacher/worker properly when logging out user
This commit is contained in:
@ -413,22 +413,20 @@ func (store *Store) Close() error {
|
||||
return store.close()
|
||||
}
|
||||
|
||||
// CloseEventLoop stops the eventloop (if it is present).
|
||||
func (store *Store) CloseEventLoop() {
|
||||
// CloseEventLoopAndCacher stops the eventloop (if it is present).
|
||||
func (store *Store) CloseEventLoopAndCacher() {
|
||||
if store.eventLoop != nil {
|
||||
store.eventLoop.stop()
|
||||
}
|
||||
|
||||
store.stopWatcher()
|
||||
|
||||
store.cacher.stop()
|
||||
}
|
||||
|
||||
func (store *Store) close() error {
|
||||
// Stop the watcher first before closing the database.
|
||||
store.stopWatcher()
|
||||
|
||||
// Stop the cacher.
|
||||
store.cacher.stop()
|
||||
|
||||
// Stop the event loop.
|
||||
store.CloseEventLoop()
|
||||
// Stop the event loop and cacher first before closing the DB.
|
||||
store.CloseEventLoopAndCacher()
|
||||
|
||||
// Close the database.
|
||||
return store.db.Close()
|
||||
|
||||
Reference in New Issue
Block a user