forked from TrueCloudLab/frostfs-node
[#930] gc: Stop internal activity by context
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
c441296592
commit
e3573de6db
5 changed files with 50 additions and 18 deletions
|
@ -329,14 +329,18 @@ func (e *StorageEngine) SetShardMode(id *shard.ID, m mode.Mode, resetErrorCounte
|
|||
}
|
||||
|
||||
// HandleNewEpoch notifies every shard about NewEpoch event.
|
||||
func (e *StorageEngine) HandleNewEpoch(epoch uint64) {
|
||||
func (e *StorageEngine) HandleNewEpoch(ctx context.Context, epoch uint64) {
|
||||
ev := shard.EventNewEpoch(epoch)
|
||||
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
for _, sh := range e.shards {
|
||||
sh.NotificationChannel() <- ev
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case sh.NotificationChannel() <- ev:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue