From 2dec2ff90e6a03fd68741a170e65d74364f39831 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sat, 1 Apr 2023 12:19:56 -0400 Subject: [PATCH] close pubsub --- internal/distributedlock/distributed_lock.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/distributedlock/distributed_lock.go b/internal/distributedlock/distributed_lock.go index bae898a..b989aea 100644 --- a/internal/distributedlock/distributed_lock.go +++ b/internal/distributedlock/distributed_lock.go @@ -71,6 +71,7 @@ func (d *DistributedLock) WaitAcquireLock(ctx context.Context, key string, timeo ch := fmt.Sprintf(lockTopicFormat, key) pubsub := d.client.Subscribe(ctx, ch) + defer func() { _ = pubsub.Close() }() select { case <-time.After(timeout):