Skip to content

Commit

Permalink
loops
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Jan 26, 2024
1 parent d572a8d commit e4d7018
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ func (e *Engine) reverifierWorker(ctx context.Context) {
wgReverify.Wait()

for _, detector := range chunk.detectors {
nextDetector := false
results := detectorResults[detector.Type().String()]

// get all the results that are NOT part of this detector
Expand All @@ -643,6 +642,8 @@ func (e *Engine) reverifierWorker(ctx context.Context) {
}
}

likelyDup := false

for _, res := range results {
var val []byte
if res.RawV2 != nil {
Expand All @@ -661,42 +662,39 @@ func (e *Engine) reverifierWorker(ctx context.Context) {
if e.reverificationTracking != nil {
e.reverificationTracking.increment()
}
wgDetect.Add(1)
chunk.chunk.Verify = false // DO NOT VERIFY
e.detectableChunksChan <- detectableChunk{
chunk: chunk.chunk,
detector: detector,
decoder: chunk.decoder,
wgDoneFn: wgDetect.Done,
}

delete(detectorsToVerify, detector.Type().String())

// Empty the dupes and detectors slice
chunkSecrets = chunkSecrets[:0]
nextDetector = true
}
if nextDetector {
break
likelyDup = true
}
}

for k, detector := range detectorsToVerify {
if likelyDup {
wgDetect.Add(1)
chunk.chunk.Verify = e.verify
chunk.chunk.Verify = false // DO NOT VERIFY
e.detectableChunksChan <- detectableChunk{
chunk: chunk.chunk,
detector: detector,
decoder: chunk.decoder,
wgDoneFn: wgDetect.Done,
}
delete(detectorsToVerify, k)

delete(detectorsToVerify, detector.Type().String())

// Empty the dupes and detectors slice
chunkSecrets = chunkSecrets[:0]
}
}

// for k := range detectorsToVerify {
// delete(detectorsToVerify, k)
// }
for k, detector := range detectorsToVerify {
wgDetect.Add(1)
chunk.chunk.Verify = e.verify
e.detectableChunksChan <- detectableChunk{
chunk: chunk.chunk,
detector: detector,
decoder: chunk.decoder,
wgDoneFn: wgDetect.Done,
}
delete(detectorsToVerify, k)
}

for k := range detectorResults {
delete(detectorResults, k)
}
Expand Down

0 comments on commit e4d7018

Please sign in to comment.