Check cancel func is nonnil before calling

Grr. Is there no tooling for this?
This commit is contained in:
David Robertson 2023-10-27 15:44:06 +01:00
parent c37e906bf5
commit db0fde8860
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -725,7 +725,9 @@ func (s *ConnState) trackProcessDuration(ctx context.Context, dur time.Duration,
func (s *ConnState) Destroy() {
s.userCache.Unsubscribe(s.userCacheID)
logger.Debug().Str("user_id", s.userID).Str("device_id", s.deviceID).Msg("cancelling any in-flight requests")
s.cancelLatestReq()
if s.cancelLatestReq != nil {
s.cancelLatestReq()
}
}
func (s *ConnState) Alive() bool {