avoid concurrent processing for the same key

This commit is contained in:
chrislu
2024-05-20 13:29:37 -07:00
parent a7d30d0705
commit 3148dec1f6
2 changed files with 12 additions and 0 deletions

View File

@@ -162,6 +162,10 @@ func (b *MessageQueueBroker) SubscribeMessage(stream mq_pb.SeaweedMessaging_Subs
// reset the sleep interval count
sleepIntervalCount = 0
for imt.IsInflight(logEntry.Key) {
time.Sleep(137 * time.Millisecond)
}
imt.InflightMessage(logEntry.Key, logEntry.TsNs)
if err := stream.Send(&mq_pb.SubscribeMessageResponse{Message: &mq_pb.SubscribeMessageResponse_Data{