staleThreshold returns the current stale timeout.
()
| 191 | |
| 192 | // staleThreshold returns the current stale timeout. |
| 193 | func (s *Service) staleThreshold() time.Duration { |
| 194 | ns := s.staleAfterNanos.Load() |
| 195 | d := time.Duration(ns) |
| 196 | if d <= 0 { |
| 197 | return DefaultStaleThreshold |
| 198 | } |
| 199 | return d |
| 200 | } |
| 201 | |
| 202 | // heartbeatInterval returns a safe ticker interval for stream heartbeats. |
| 203 | // It is half the stale threshold so at least one touch lands before the |
no test coverage detected