fix(proxy): avoid registration insert readback - #259
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A new SIP registration could return
503 Service Unavailableeven though the locator row had already beeninserted successfully.
The database-backed locator used
ActiveModel::insert(). On MySQL, SeaORM executes theINSERTand thenimmediately queries the inserted row by its generated ID to return the complete model. If that follow-up read
does not observe the row yet, SeaORM returns:
The registrar treated this as a storage failure and returned SIP 503, although it never used the returned
model.
Reproduction
A regression test reproduces the exact database sequence:
Before the fix, the test fails with the same Failed to find inserted item error observed at runtime.
Fix
Use Entity::insert(active_model).exec() for new locator rows.
This checks that the INSERT succeeds without fetching the complete row afterward. Real insert errors are still
propagated; no retry, delay, or error suppression is introduced.
Verification
The regression test was verified with a red-green cycle: