[#1555] engine: Refactor (*StorageEngine).GetLocks
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 3m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m41s
DCO action / DCO (pull_request) Successful in 4m57s
Vulncheck / Vulncheck (pull_request) Successful in 5m28s
Build / Build Components (pull_request) Successful in 5m46s
Tests and linters / Staticcheck (pull_request) Successful in 6m0s
Tests and linters / Tests (pull_request) Successful in 6m34s
Tests and linters / Lint (pull_request) Successful in 6m51s
Tests and linters / Tests with -race (pull_request) Successful in 7m50s
Tests and linters / gopls check (pull_request) Successful in 2m51s
Tests and linters / Run gofumpt (push) Successful in 1m16s
Tests and linters / Staticcheck (push) Successful in 3m13s
Vulncheck / Vulncheck (push) Successful in 3m46s
Build / Build Components (push) Successful in 4m11s
Tests and linters / Lint (push) Successful in 4m26s
Pre-commit hooks / Pre-commit (push) Successful in 4m47s
Tests and linters / Tests with -race (push) Successful in 6m8s
Tests and linters / gopls check (push) Successful in 6m13s
Tests and linters / Tests (push) Successful in 2m36s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 3m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m41s
DCO action / DCO (pull_request) Successful in 4m57s
Vulncheck / Vulncheck (pull_request) Successful in 5m28s
Build / Build Components (pull_request) Successful in 5m46s
Tests and linters / Staticcheck (pull_request) Successful in 6m0s
Tests and linters / Tests (pull_request) Successful in 6m34s
Tests and linters / Lint (pull_request) Successful in 6m51s
Tests and linters / Tests with -race (pull_request) Successful in 7m50s
Tests and linters / gopls check (pull_request) Successful in 2m51s
Tests and linters / Run gofumpt (push) Successful in 1m16s
Tests and linters / Staticcheck (push) Successful in 3m13s
Vulncheck / Vulncheck (push) Successful in 3m46s
Build / Build Components (push) Successful in 4m11s
Tests and linters / Lint (push) Successful in 4m26s
Pre-commit hooks / Pre-commit (push) Successful in 4m47s
Tests and linters / Tests with -race (push) Successful in 6m8s
Tests and linters / gopls check (push) Successful in 6m13s
Tests and linters / Tests (push) Successful in 2m36s
Refactored after renaming the method to replace the confusing `locked` variable with `locks`. Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
72470d6b48
commit
3821645085
1 changed files with 6 additions and 6 deletions
|
@ -262,23 +262,23 @@ func (e *StorageEngine) GetLocks(ctx context.Context, addr oid.Address) ([]oid.I
|
|||
))
|
||||
defer span.End()
|
||||
|
||||
var locked []oid.ID
|
||||
var allLocks []oid.ID
|
||||
var outErr error
|
||||
|
||||
e.iterateOverUnsortedShards(func(h hashedShard) (stop bool) {
|
||||
ld, err := h.Shard.GetLocks(ctx, addr)
|
||||
locks, err := h.Shard.GetLocks(ctx, addr)
|
||||
if err != nil {
|
||||
e.reportShardError(ctx, h, logs.EngineInterruptGettingLockers, err, zap.Stringer("address", addr),
|
||||
zap.String("trace_id", tracingPkg.GetTraceID(ctx)))
|
||||
outErr = err
|
||||
}
|
||||
locked = append(locked, ld...)
|
||||
allLocks = append(allLocks, locks...)
|
||||
return false
|
||||
})
|
||||
if len(locked) > 0 {
|
||||
return locked, nil
|
||||
if len(allLocks) > 0 {
|
||||
return allLocks, nil
|
||||
}
|
||||
return locked, outErr
|
||||
return allLocks, outErr
|
||||
}
|
||||
|
||||
func (e *StorageEngine) processExpiredTombstones(ctx context.Context, addrs []meta.TombstonedObject) {
|
||||
|
|
Loading…
Reference in a new issue