-
Notifications
You must be signed in to change notification settings - Fork 0
Add wrapper struct to durable events and store trace context #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b4fc63b
e0b5ae2
e000963
8604a95
ec45961
f5909de
8ac0de2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -792,7 +792,10 @@ begin | |
| perform durable.emit_event( | ||
| p_queue_name, | ||
| '$child:' || p_task_id::text, | ||
| jsonb_build_object('status', p_status) || coalesce(p_payload, '{}'::jsonb) | ||
| jsonb_build_object( | ||
| 'inner', jsonb_build_object('status', p_status) || coalesce(p_payload, '{}'::jsonb), | ||
| 'metadata', '{}'::jsonb | ||
| ) | ||
| ); | ||
| end if; | ||
|
|
||
|
|
@@ -1423,6 +1426,23 @@ begin | |
| raise exception 'event_name must be provided'; | ||
| end if; | ||
|
|
||
| -- Validate that if p_payload is not null, it has exactly the allowed keys ('inner' and 'metadata') | ||
| if p_payload is not null and jsonb_typeof(p_payload) = 'object' then | ||
| if exists ( | ||
| select 1 | ||
| from jsonb_object_keys(p_payload) as k | ||
| where k not in ('inner', 'metadata') | ||
| ) then | ||
| raise exception 'p_payload may only contain ''inner'' and ''metadata'' keys'; | ||
| end if; | ||
| if not p_payload ? 'inner' then | ||
| raise exception 'p_payload must contain an ''inner'' key'; | ||
| end if; | ||
| if not p_payload ? 'metadata' then | ||
| raise exception 'p_payload must contain a ''metadata'' key'; | ||
| end if; | ||
| end if; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SQL validation allows non-object payloads causing Rust errorsLow Severity The SQL validation in Additional Locations (1) |
||
|
|
||
| -- Insert the event into the events table (first-writer-wins). | ||
| -- Subsequent emits for the same event are no-ops. | ||
| -- We use DO UPDATE WHERE payload IS NULL to handle the case where await_event | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.