Skip to content

Commit

Permalink
don't retry operations that have conflict error
Browse files Browse the repository at this point in the history
If an operation receives a conflict error from the blockchain connector,
currently it will continutally retry submitting that operation but it will
never succeed. Instead, we shouldn't retry if we know the connector has
received the submission.

Signed-off-by: Alex Shorsher <[email protected]>
  • Loading branch information
shorsher committed Oct 30, 2024
1 parent 1939b67 commit 68ad190
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/batch/batch_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@ func (bp *batchProcessor) dispatchBatch(payload *DispatchPayload) error {
}
}
}
conflictErr, conflictTestOk := err.(operations.ConflictError)
if conflictTestOk && conflictErr.IsConflictError() {
// We know that the connector has received our batch, so we shouldn't need to retry
return true, nil
}

Check warning on line 640 in internal/batch/batch_processor.go

View check run for this annotation

Codecov / codecov/patch

internal/batch/batch_processor.go#L638-L640

Added lines #L638 - L640 were not covered by tests
} else {
if core.IsPinned(payload.Batch.TX.Type) {
payload.addMessageUpdate(payload.Messages, core.MessageStateReady, core.MessageStateSent)
Expand Down

0 comments on commit 68ad190

Please sign in to comment.