shut down the index if there is an error during head processing

This commit is contained in:
vyzo 2023-03-16 17:41:06 +02:00 committed by Maciej Witowski
parent e11e0eb32a
commit 9a0ec84953

View File

@ -314,8 +314,11 @@ func (x *msgIndex) background(ctx context.Context) {
case <-x.sema: case <-x.sema:
err := x.processHeadChanges(ctx) err := x.processHeadChanges(ctx)
if err != nil { if err != nil {
// TODO should we shut down the index altogether? we just log for now. // we can't rely on an inconsistent index, so shut it down.
log.Errorf("error processing head change notifications: %s", err) log.Errorf("error processing head change notifications: %s; shutting down message index", err)
if err2 := x.Close(); err2 != nil {
log.Errorf("error shutting down index: %s", err2)
}
} }
case <-ctx.Done(): case <-ctx.Done():