Skip to content

Commit e76c4db

Browse files
committed
fix: lockcontext tries
1 parent c04a82e commit e76c4db

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

mutex.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (m *Mutex) lockContext(ctx context.Context, tries int) error {
125125
return m.release(ctx, pool, value)
126126
})
127127
}()
128-
if i == m.tries-1 && err != nil {
128+
if i == tries-1 && err != nil {
129129
return err
130130
}
131131
}

mutex_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestMutexAlreadyLocked(t *testing.T) {
9797
assertAcquired(ctx, t, v.pools, mutex1)
9898

9999
mutex2 := rs.NewMutex(key)
100-
err = mutex2.Lock()
100+
err = mutex2.TryLock()
101101
var errTaken *ErrTaken
102102
if !errors.As(err, &errTaken) {
103103
t.Fatalf("mutex was not already locked: %s", err)

0 commit comments

Comments
 (0)