From 8615d21a1f8e00a003d609bca6f1dd4eef5a72ff Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 1 Oct 2020 20:49:13 -0400 Subject: [PATCH] Remove connection from worker if in terminated state and all conns are closed, not just in canceling state --- internal/servers/worker/status.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/servers/worker/status.go b/internal/servers/worker/status.go index 25e052b78b..be1c1cb07e 100644 --- a/internal/servers/worker/status.go +++ b/internal/servers/worker/status.go @@ -137,8 +137,10 @@ func (w *Worker) startStatusTicking(cancelCtx context.Context) { w.sessionInfoMap.Range(func(key, value interface{}) bool { si := value.(*sessionInfo) si.Lock() - if time.Until(si.lookupSessionResponse.Expiration.AsTime()) < 0 || - si.status == pbs.SESSIONSTATUS_SESSIONSTATUS_CANCELING { + switch { + case si.status == pbs.SESSIONSTATUS_SESSIONSTATUS_CANCELING, + si.status == pbs.SESSIONSTATUS_SESSIONSTATUS_TERMINATED, + time.Until(si.lookupSessionResponse.Expiration.AsTime()) < 0: var toClose int for k, v := range si.connInfoMap { if v.closeTime.IsZero() {