forked from TrueCloudLab/frostfs-node
[#1047] policer: Check context before job selection
When application is being terminated, replicator routine might be on the object picking phase. Storage is terminated asynchronously, thus `Select()` may return corresponding error. If we don't process `context.Done()` in this case, then application freezes on shutdown. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
11466ea3cc
commit
bca7cf9470
1 changed files with 6 additions and 0 deletions
|
@ -27,6 +27,12 @@ func (p *Policer) shardPolicyWorker(ctx context.Context) {
|
|||
)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
addrs, cursor, err = p.jobQueue.Select(cursor, p.batchSize)
|
||||
if err != nil {
|
||||
if errors.Is(err, engine.ErrEndOfListing) {
|
||||
|
|
Loading…
Reference in a new issue