listen ctx for closing object

This commit is contained in:
Sergey Cherepanov 2023-02-13 21:49:56 +03:00 committed by Mikhail Iudin
parent 703bf4fda6
commit f858d39534
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -176,9 +176,13 @@ Load:
}
c.mu.Unlock()
if closing {
<-e.close
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-e.close:
goto Load
}
}
if load {
go c.load(ctx, id, e)