Skip to content

Commit cf7b89d

Browse files
committed
Issue #145.
1 parent ff9f27a commit cf7b89d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

conn.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,20 @@ func timeoutCallback(ctx context.Context, mod api.Module, pDB uint32, count, tmo
389389
}
390390

391391
if delay = min(delay, tmout-prior); delay > 0 {
392-
time.Sleep(time.Duration(delay) * time.Millisecond)
393-
retry = 1
392+
delay := time.Duration(delay) * time.Millisecond
393+
if c.interrupt == nil || c.interrupt.Done() == nil {
394+
time.Sleep(delay)
395+
return 1
396+
}
397+
select {
398+
case <-c.interrupt.Done():
399+
//
400+
case <-time.After(delay):
401+
return 1
402+
}
394403
}
395404
}
396-
return retry
405+
return 0
397406
}
398407

399408
// BusyHandler registers a callback to handle [BUSY] errors.

0 commit comments

Comments
 (0)