From 3466d20b808eee43c75e4fb12d307b952a820441 Mon Sep 17 00:00:00 2001 From: Christopher LaPointe Date: Tue, 23 May 2023 21:10:16 -0400 Subject: [PATCH] Add cancel defer --- pkg/service/service.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/service/service.go b/pkg/service/service.go index 8ae831f..bcb633f 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -138,7 +138,8 @@ func (s *Core) Poll() { s.mux.Lock() defer s.mux.Unlock() - ctx, _ := context.WithTimeout(context.Background(), 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() s.checkForNewContainers(ctx) s.watchForInactivity(ctx)