Skip to content

Commit

Permalink
style(asyncloader): cleanup code to check error
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Oct 6, 2021
1 parent 7cc6956 commit 6506c45
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions requestmanager/asyncloader/asyncloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,17 @@ func (al *AsyncLoader) CompleteResponsesFor(requestID graphsync.RequestID) {
func (al *AsyncLoader) CleanupRequest(p peer.ID, requestID graphsync.RequestID) {
al.stateLk.Lock()
defer al.stateLk.Unlock()
responseCache := al.responseCache
aq, ok := al.requestQueues[requestID]
if ok {
toFree := al.alternateQueues[aq].responseCache.FinishRequest(requestID)
al.allocator.ReleaseBlockMemory(p, toFree)
responseCache = al.alternateQueues[aq].responseCache
delete(al.requestQueues, requestID)
return
}
toFree := al.responseCache.FinishRequest(requestID)
al.allocator.ReleaseBlockMemory(p, toFree)
toFree := responseCache.FinishRequest(requestID)
err := al.allocator.ReleaseBlockMemory(p, toFree)
if err != nil {
log.Infow("Error deallocating requestor memory", "p", p, "toFree", toFree, "err", err)
}
}

func (al *AsyncLoader) getLoadAttemptQueue(queue string) *loadattemptqueue.LoadAttemptQueue {
Expand Down

0 comments on commit 6506c45

Please sign in to comment.