Skip to content

Commit e8f9f34

Browse files
committed
review feedback: dedent, continue
Signed-off-by: Dr. Jan-Philip Gehrcke <[email protected]>
1 parent dd0ae60 commit e8f9f34

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/flock/flock.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,9 @@ func (l *Flock) Acquire(ctx context.Context, opts ...AcquireOption) (func(), err
9999
// Lock is currently held by other entity. Check for exit criteria;
100100
// otherwise retry lock acquisition upon next tick.
101101

102-
if cfg.timeout > 0 {
103-
if time.Since(t0) > cfg.timeout {
104-
f.Close()
105-
return nil, fmt.Errorf("timeout acquiring lock (%s)", l.path)
106-
}
102+
if cfg.timeout > 0 && time.Since(t0) > cfg.timeout {
103+
f.Close()
104+
return nil, fmt.Errorf("timeout acquiring lock (%s)", l.path)
107105
}
108106

109107
select {
@@ -112,6 +110,7 @@ func (l *Flock) Acquire(ctx context.Context, opts ...AcquireOption) (func(), err
112110
return nil, ctx.Err()
113111
case <-ticker.C:
114112
// Retry flock().
113+
continue
115114
}
116115
}
117116
}

0 commit comments

Comments
 (0)