mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +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()
|
return store.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloseEventLoop stops the eventloop (if it is present).
|
// CloseEventLoopAndCacher stops the eventloop (if it is present).
|
||||||
func (store *Store) CloseEventLoop() {
|
func (store *Store) CloseEventLoopAndCacher() {
|
||||||
if store.eventLoop != nil {
|
if store.eventLoop != nil {
|
||||||
store.eventLoop.stop()
|
store.eventLoop.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store.stopWatcher()
|
||||||
|
|
||||||
|
store.cacher.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *Store) close() error {
|
func (store *Store) close() error {
|
||||||
// Stop the watcher first before closing the database.
|
// Stop the event loop and cacher first before closing the DB.
|
||||||
store.stopWatcher()
|
store.CloseEventLoopAndCacher()
|
||||||
|
|
||||||
// Stop the cacher.
|
|
||||||
store.cacher.stop()
|
|
||||||
|
|
||||||
// Stop the event loop.
|
|
||||||
store.CloseEventLoop()
|
|
||||||
|
|
||||||
// Close the database.
|
// Close the database.
|
||||||
return store.db.Close()
|
return store.db.Close()
|
||||||
|
|||||||
@ -450,7 +450,7 @@ func (u *User) Logout() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do not close whole store, just event loop. Some information might be needed offline (e.g. addressID)
|
// Do not close whole store, just event loop. Some information might be needed offline (e.g. addressID)
|
||||||
u.closeEventLoop()
|
u.closeEventLoopAndCacher()
|
||||||
|
|
||||||
u.CloseAllConnections()
|
u.CloseAllConnections()
|
||||||
|
|
||||||
@ -459,12 +459,12 @@ func (u *User) Logout() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) closeEventLoop() {
|
func (u *User) closeEventLoopAndCacher() {
|
||||||
if u.store == nil {
|
if u.store == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u.store.CloseEventLoop()
|
u.store.CloseEventLoopAndCacher()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloseAllConnections calls CloseConnection for all users addresses.
|
// CloseAllConnections calls CloseConnection for all users addresses.
|
||||||
|
|||||||
Reference in New Issue
Block a user