fix(listener): simplify lease renewal logic by removing unnecessary locks
yoonhyunwoo committed
Apr 10, 2026 at 23:45 UTC
f369e2762857635a1d0ccbb01ba1382b3a9759b1
1 file changed
+1
-6
sdk/listener.go
+1
-6
@@ -423,15 +423,10 @@ func (l *Listener) runRenewLoop(ctx context.Context) {
423
}
424
425
func (l *Listener) renewLease(ctx context.Context) error {
426
- l.api.mu.RLock()
427
- expiresAt := l.api.expiresAt
428
- l.api.mu.RUnlock()
429
-
430
- if time.Now().Before(expiresAt) {
426
+ if time.Now().Before(l.api.expiresAt) {
427
requestCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
428
err := l.api.renewLease(requestCtx, l.leaseTTL)
429
cancel()
434
-
430
if err == nil {
431
return nil
432
}