Skip to content

Commit bdaaae4

Browse files
authored
OTHER: fixing race condition queueing things for processing. This only happens in streaming strategy combined with very small blob size on the BP bucket. There existed the possibility that a blob would be added to the queue twice. This explicitly prevents the double queuing of blobs. (#101)
1 parent e869db5 commit bdaaae4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

helpers/blobQueue.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package helpers
33
import (
44
"errors"
55
helperModels "github.com/SpectraLogic/ds3_go_sdk/helpers/models"
6+
"reflect"
67
)
78

89
// A queue that manages descriptions of blobs
@@ -25,6 +26,12 @@ func NewBlobDescriptionQueue() BlobDescriptionQueue {
2526
}
2627

2728
func (queue *blobDescriptionQueueImpl) Push(description *helperModels.BlobDescription) {
29+
// verify that this blob isn't already in the queue before adding it
30+
for _, existingBlob := range queue.queue {
31+
if reflect.DeepEqual(*existingBlob, *description) {
32+
return
33+
}
34+
}
2835
queue.queue = append(queue.queue, description)
2936
}
3037

0 commit comments

Comments
 (0)