Return context cancelations as a locker locked error

This commit is contained in:
Dane Everitt 2022-01-31 18:39:41 -05:00
parent 1e52ffef64
commit 6a4178648f

View File

@ -51,7 +51,9 @@ func (l *Locker) TryAcquire(ctx context.Context) error {
return nil
case <-ctx.Done():
if err := ctx.Err(); err != nil {
return err
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
return ErrLockerLocked
}
}
return nil
}