mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
feat(storage): rebuild storage(s3/local) dedupe index when switching dedupe status (#1062)
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
@@ -52,7 +52,11 @@ func (pq *generatorsPriorityQueue) Pop() any {
|
||||
return item
|
||||
}
|
||||
|
||||
const rateLimiterScheduler = 400
|
||||
const (
|
||||
rateLimiterScheduler = 400
|
||||
rateLimit = 5 * time.Second
|
||||
numWorkers = 3
|
||||
)
|
||||
|
||||
type Scheduler struct {
|
||||
tasksQLow chan Task
|
||||
@@ -63,6 +67,7 @@ type Scheduler struct {
|
||||
generatorsLock *sync.Mutex
|
||||
log log.Logger
|
||||
stopCh chan struct{}
|
||||
RateLimit time.Duration
|
||||
}
|
||||
|
||||
func NewScheduler(logC log.Logger) *Scheduler {
|
||||
@@ -82,14 +87,11 @@ func NewScheduler(logC log.Logger) *Scheduler {
|
||||
generatorsLock: new(sync.Mutex),
|
||||
log: log.Logger{Logger: sublogger},
|
||||
stopCh: make(chan struct{}),
|
||||
// default value
|
||||
RateLimit: rateLimit,
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
rateLimit = 5 * time.Second
|
||||
numWorkers = 3
|
||||
)
|
||||
|
||||
func (scheduler *Scheduler) poolWorker(numWorkers int, tasks chan Task) {
|
||||
for i := 0; i < numWorkers; i++ {
|
||||
go func(workerID int) {
|
||||
@@ -120,6 +122,8 @@ func (scheduler *Scheduler) RunScheduler(ctx context.Context) {
|
||||
close(tasksWorker)
|
||||
close(scheduler.stopCh)
|
||||
|
||||
scheduler.log.Debug().Msg("scheduler: received stop signal, exiting...")
|
||||
|
||||
return
|
||||
default:
|
||||
i := 0
|
||||
|
||||
Reference in New Issue
Block a user