policer: Simplify processRepNodes() checks #1605

Merged
fyrchik merged 2 commits from fyrchik/frostfs-node:refactor-policer into master 2025-01-21 05:34:55 +00:00

2 commits

Author SHA1 Message Date
3d953d7185
[#1605] policer: Do not mutate slice under iteration
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 27s
DCO action / DCO (pull_request) Successful in 36s
Vulncheck / Vulncheck (pull_request) Successful in 1m6s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m23s
Build / Build Components (pull_request) Successful in 1m38s
Tests and linters / Staticcheck (pull_request) Successful in 1m56s
Tests and linters / Lint (pull_request) Successful in 2m44s
Tests and linters / Tests (pull_request) Successful in 2m57s
Tests and linters / gopls check (pull_request) Successful in 4m12s
Tests and linters / Tests with -race (pull_request) Successful in 4m23s
Nothing wrong with it, besides being difficult to read.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-20 16:30:11 +03:00
91c8a1a1fc
[#1605] policer: Simplify processRepNodes() checks
Current flow is hard to reason about, #1601 is a notorious example of
accidental complexity.
1. Remove multiple nested ifs, use depth=1.
2. Process each status exactly once, hopefully preventing bugs like
   #1601.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-20 16:30:11 +03:00