TUN-5530: Get current time from ticker
This commit is contained in:
parent
b0e27d1eac
commit
9251b3aa1f
|
@ -77,9 +77,10 @@ func (s *Session) waitForCloseCondition(ctx context.Context, closeAfterIdle time
|
||||||
return
|
return
|
||||||
case <-s.doneChan:
|
case <-s.doneChan:
|
||||||
return
|
return
|
||||||
case <-checkIdleTicker.C:
|
// TODO: TUN-5423 evaluate if using atomic is more efficient
|
||||||
|
case now := <-checkIdleTicker.C:
|
||||||
// The session is considered inactive if current time is after (last active time + allowed idle time)
|
// The session is considered inactive if current time is after (last active time + allowed idle time)
|
||||||
if time.Now().After(activeAt.Add(closeAfterIdle)) {
|
if now.After(activeAt.Add(closeAfterIdle)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case activeAt = <-s.activeAtChan: // Update last active time
|
case activeAt = <-s.activeAtChan: // Update last active time
|
||||||
|
|
Loading…
Reference in New Issue