From 7c6a0b5f11fa1e9a5a2a84787e782b5ec96f3b9f Mon Sep 17 00:00:00 2001 From: gammazero Date: Mon, 31 Jul 2023 17:37:07 -0700 Subject: [PATCH] Close subscriber after each use --- pkg/adpub/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/adpub/client.go b/pkg/adpub/client.go index 893720a..d910d92 100644 --- a/pkg/adpub/client.go +++ b/pkg/adpub/client.go @@ -130,6 +130,8 @@ func (c *client) Distance(ctx context.Context, oldestCid, newestCid cid.Cid) (in if err != nil { return 0, cid.Undef, err } + defer sub.Close() + newestCid, err = sub.Sync(ctx, c.publisher, newestCid, sel) if err != nil { return 0, cid.Undef, err