Skip to content

Commit

Permalink
aws/sqs: handle duplicate recieves of inflight stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rockwotj committed Jan 7, 2025
1 parent b5773e6 commit 341cd6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/impl/aws/input_sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,15 @@ func (t *sqsInFlightTracker) AddNew(ctx context.Context, messages ...sqsMessage)
if m.handle == nil {
continue
}
e := t.fifo.PushBack(m.handle)
t.handles[m.handle.id] = e
// If this is a duplicate (a re-recieve of an inflight message due to timeout)
// we can just update the existing handle.
if e, ok := t.handles[m.handle.id]; ok {
e.Value = m.handle
t.fifo.MoveToBack(e)
} else {
e := t.fifo.PushBack(m.handle)
t.handles[m.handle.id] = e
}
}
}

Expand Down

0 comments on commit 341cd6f

Please sign in to comment.