Browse Source

replication resync: avoid blocking on results channel. (#17981)

continues fix in #17775
pull/17986/head
Poorna 2 years ago
committed by GitHub
parent
commit
13a2dc8485
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      cmd/bucket-replication.go

13
cmd/bucket-replication.go

@ -2531,6 +2531,13 @@ func (s *replicationResyncer) resyncBucket(ctx context.Context, objectAPI Object
workers := make([]chan ReplicateObjectInfo, resyncParallelRoutines)
resultCh := make(chan TargetReplicationResyncStatus, 1)
defer close(resultCh)
go func() {
for r := range resultCh {
s.incStats(r, opts)
globalSiteResyncMetrics.updateMetric(r, opts.resyncID)
}
}()
var wg sync.WaitGroup
for i := 0; i < resyncParallelRoutines; i++ {
wg.Add(1)
@ -2635,12 +2642,6 @@ func (s *replicationResyncer) resyncBucket(ctx context.Context, objectAPI Object
for i := 0; i < resyncParallelRoutines; i++ {
close(workers[i])
}
go func() {
for r := range resultCh {
s.incStats(r, opts)
globalSiteResyncMetrics.updateMetric(r, opts.resyncID)
}
}()
wg.Wait()
resyncStatus = ResyncCompleted
}

Loading…
Cancel
Save