lib: Fix panic due to closed event subscriptions on shutdown (#8079)

This commit is contained in:
Gahl Saraf
2021-12-22 20:16:21 +01:00
committed by GitHub
parent bf7f82f7b2
commit cc39341eb9
4 changed files with 19 additions and 5 deletions
+5 -1
View File
@@ -178,7 +178,11 @@ func (c *folderSummaryService) listenForUpdates(ctx context.Context) error {
// This loop needs to be fast so we don't miss too many events.
select {
case ev := <-sub.C():
case ev, ok := <-sub.C():
if !ok {
<-ctx.Done()
return ctx.Err()
}
c.processUpdate(ev)
case <-ctx.Done():
return ctx.Err()