Multiple wait events fix and machineId supported#46
Merged
Conversation
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
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.
Summary
Fixes two issues surfaced while running the birthday-card-generator example against the local Platformatic cluster:
Duplicate
wait_*events crash workflow replay. The SELECT-then-INSERT inplugins/events.tsraces under concurrent dispatch retries, producing twowait_created/wait_completedrows for the samecorrelation_id. The SDK then fails replay withUnconsumed event in event logand the run dead-letters.ICC handler registration rejected. ICC PR icc3#788 renamed
podId→machineIdin the body it POSTs to/api/v1/apps/:appId/handlers. The workflow service still requiredpodIdand 400'd every registration, soworkflow_queue_handlersstayed empty and queue messages had nowhere to dispatch.Changes
migrations/003.do.sql— partial unique index(run_id, event_type, correlation_id)forwait_createdandwait_completed. Intentionally does not coverhook_*:createHookasync iterators legitimately produce multiplehook_receivedevents on the same correlation id.plugins/events.ts—insertEventusesINSERT … ON CONFLICT DO NOTHINGfor the deduped types and falls back to a SELECT when the conflict fires, so callers still receive a row.plugins/handlers.ts—/handlersaccepts eitherpodId(legacy) ormachineId(post-#788), keeping the existing contract working while letting current ICC clients register.