diff --git a/internal/impl/aws/input_sqs.go b/internal/impl/aws/input_sqs.go index 7293f73ed..aa5e48672 100644 --- a/internal/impl/aws/input_sqs.go +++ b/internal/impl/aws/input_sqs.go @@ -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 + } } }