forked from TrueCloudLab/frostfs-node
[#255] services/audit: Skip all tasks from previous epoch in audit processor
Implement Reset method on audit task manager that cleans task queue. Extended TaskManager interface with Reset method on IR side. Call Reset method in audit processor before new audit start. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
33804e024d
commit
76d4e53ea0
3 changed files with 10 additions and 0 deletions
|
@ -21,6 +21,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {
|
||||||
log := ap.log.With(zap.Uint64("epoch", epoch))
|
log := ap.log.With(zap.Uint64("epoch", epoch))
|
||||||
|
|
||||||
ap.prevAuditCanceler()
|
ap.prevAuditCanceler()
|
||||||
|
ap.taskManager.Reset()
|
||||||
|
|
||||||
containers, err := ap.selectContainersToAudit(epoch)
|
containers, err := ap.selectContainersToAudit(epoch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -30,6 +30,7 @@ type (
|
||||||
|
|
||||||
TaskManager interface {
|
TaskManager interface {
|
||||||
PushTask(*audit.Task) error
|
PushTask(*audit.Task) error
|
||||||
|
Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Processor of events related with data audit.
|
// Processor of events related with data audit.
|
||||||
|
|
8
pkg/services/audit/taskmanager/reset.go
Normal file
8
pkg/services/audit/taskmanager/reset.go
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package audittask
|
||||||
|
|
||||||
|
// Reset pops all tasks from the queue.
|
||||||
|
func (m *Manager) Reset() {
|
||||||
|
for len(m.ch) > 0 {
|
||||||
|
<-m.ch
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue