Pause event loop while FETCHing to prevetn EXPUNGE

This commit is contained in:
Michal Horejsek
2020-07-23 09:09:52 +02:00
parent 9d65192ad7
commit 2269a9edb7
6 changed files with 33 additions and 5 deletions

View File

@ -348,6 +348,18 @@ func (store *Store) addAddress(address, addressID string, labels []*pmapi.Label)
return
}
// PauseEventLoop sets whether the ticker is periodically polling or not.
func (store *Store) PauseEventLoop(pause bool) {
store.lock.Lock()
defer store.lock.Unlock()
store.log.WithField("pause", pause).Info("Pausing event loop")
if store.eventLoop != nil {
store.eventLoop.isTickerPaused = pause
}
}
// Close stops the event loop and closes the database to free the file.
func (store *Store) Close() error {
store.lock.Lock()