listen ctx for closing object

This commit is contained in:
Sergey Cherepanov 2023-02-13 21:49:56 +03:00
parent 4c00dba1cf
commit 18451bd4fe
No known key found for this signature in database
GPG Key ID: 87F8EDE8FBDF637C

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)