Skip to content

Commit

Permalink
Merge pull request #55 from anyproto/GO-2328--update-key-usage
Browse files Browse the repository at this point in the history
GO-2328 update usage for a CheckKey method
  • Loading branch information
fb929 authored Nov 6, 2023
2 parents 0fbfded + 29220c4 commit 271e18d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions index/cids.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (ri *redisIndex) CidEntriesByBlocks(ctx context.Context, bs []blocks.Block)
continue
}
if err = ri.getAndAddToEntries(ctx, entries, b.Cid()); err != nil {
entries.Release()
return nil, err
}
visited[b.Cid().KeyString()] = struct{}{}
Expand Down
6 changes: 6 additions & 0 deletions index/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func (ri *redisIndex) CheckKey(ctx context.Context, key string) (exists bool, er
if exists, release, err = ri.acquireKey(ctx, key); err != nil {
return
}
if exists {
if err = ri.updateKeyUsage(ctx, key); err != nil {
release()
return false, err
}
}
release()
return
}
Expand Down

0 comments on commit 271e18d

Please sign in to comment.