Skip to content

Commit

Permalink
update usage for CheckKey
Browse files Browse the repository at this point in the history
  • Loading branch information
cheggaaa committed Nov 5, 2023
1 parent 0fbfded commit 29220c4
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 29220c4

Please sign in to comment.