GODT-1350: stop cacher/worker properly when logging out user

This commit is contained in:
James Houlahan
2021-09-17 11:30:43 +02:00
committed by Jakub
parent aeceb7d593
commit 18257f0302
2 changed files with 11 additions and 13 deletions

View File

@ -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()