Skip to content

Commit 803f7ea

Browse files
committed
made suggested changes
1 parent 17a9c2c commit 803f7ea

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

fern/docs/pages/references/functions.mdx

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ functions:
2929

3030
### Synchronous execution with synchronization key
3131

32-
To ensure that function executions are processed in order, FIFO, for a given context such as a user or conversation, enable synchronization support in your function’s manifest and use a synchronization key, sync-id.
32+
To ensure that function executions are processed in order, FIFO, for a given context such as a user or conversation, enable synchronization support in your function’s manifest and use a synchronization key, sync_id.
3333

34-
#### How it works
34+
The platform uses the sync_id as the message group for FIFO processing. This ensures that all executions with the same sync_id are processed in order, preventing race conditions or duplicate conversations.
35+
Use cases for synchronous execution include:
36+
37+
- Ensuring order of message processing for chatbots or messaging integrations.
38+
- Preventing duplicate or out-of-order actions when multiple events are triggered.
39+
40+
To enable this:
3541

3642
1. Enable synchronization in manifest
3743
- In your function’s manifest, add the field:
@@ -44,8 +50,8 @@ To ensure that function executions are processed in order, FIFO, for a given con
4450
- This tells the platform to use a FIFO queue for this function.
4551

4652
1. Set the synchronization key
47-
- When triggering an automation, include the sync-id in your rego policy along with the `event_key`. For example:
48-
```rego focus
53+
- When triggering an automation, include the sync_id in your rego policy along with the `event_key`. For example:
54+
```rego rego
4955
package rego
5056
5157
output = {"event": event, "event_key": event_key, "sync_id": sync_id} {
@@ -60,24 +66,12 @@ To ensure that function executions are processed in order, FIFO, for a given con
6066
}
6167
```
6268

63-
- The sync-id groups related executions for ordered processing.
64-
69+
- The sync_id groups related executions for ordered processing.
6570

6671
3. Execution behavior
67-
- If `supports_synchronization` is true and a sync-id is provided, executions with the same sync-id are processed in order.
68-
- If no sync-id is provided, executions are grouped by a random string.
69-
- If `supports_synchronization` is false, the sync-id is ignored and executions are processed as usual.
70-
71-
#### Platform behavior
72-
73-
- The platform uses the sync-id as the message group for FIFO processing.
74-
- This ensures that all executions with the same sync-id are processed in order, preventing race conditions or duplicate conversations.
75-
76-
#### Use cases
77-
78-
- Ensuring order of message processing for chatbots or messaging integrations.
79-
- Preventing duplicate or out-of-order actions when multiple events are triggered.
80-
72+
- If `supports_synchronization` is true and a sync_id is provided, executions with the same sync_id are processed in order.
73+
- If no sync_id is provided, executions are grouped by a random string.
74+
- If `supports_synchronization` is false, the sync_id is ignored and executions are processed as usual.
8175

8276

8377
<Callout intent="note">

0 commit comments

Comments
 (0)