From 133354bba0313214b952627ed798f796fe54678d Mon Sep 17 00:00:00 2001 From: Joshua Kim <20001595+joshua-kim@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:09:13 -0400 Subject: [PATCH] nit Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com> --- x/sync/manager.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/sync/manager.go b/x/sync/manager.go index ddcdc1637088..aad214a820f6 100644 --- a/x/sync/manager.go +++ b/x/sync/manager.go @@ -370,14 +370,14 @@ func (m *Manager) requestChangeProof(ctx context.Context, work *workItem) { } onResponse := func(ctx context.Context, _ ids.NodeID, responseBytes []byte, err error) { - defer m.finishWorkItem() - if err := m.handleChangeProofResponse(ctx, targetRootID, work, request, responseBytes, err); err != nil { // TODO log responses m.config.Log.Debug("dropping response", zap.Error(err), zap.Stringer("request", request)) m.retryWork(work) return } + + m.finishWorkItem() } if err := m.sendRequest(ctx, m.config.ChangeProofClient, requestBytes, onResponse); err != nil { @@ -428,14 +428,14 @@ func (m *Manager) requestRangeProof(ctx context.Context, work *workItem) { } onResponse := func(ctx context.Context, _ ids.NodeID, responseBytes []byte, appErr error) { - defer m.finishWorkItem() - if err := m.handleRangeProofResponse(ctx, targetRootID, work, request, responseBytes, appErr); err != nil { // TODO log responses m.config.Log.Debug("dropping response", zap.Error(err), zap.Stringer("request", request)) m.retryWork(work) return } + + m.finishWorkItem() } if err := m.sendRequest(ctx, m.config.RangeProofClient, requestBytes, onResponse); err != nil { @@ -467,6 +467,7 @@ func (m *Manager) retryWork(work *workItem) { m.workLock.Lock() m.unprocessedWork.Insert(work) + m.processingWorkItems-- m.workLock.Unlock() m.unprocessedWorkCond.Signal() }