Skip to content

Commit 41c0bc1

Browse files
author
markzegarelli
authored
Merge pull request #1734 from segmentio/functions-single-event-handlers
functions: single event handlers are no longer necessary when batching
2 parents 5040624 + 8221917 commit 41c0bc1

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/connections/functions/destination-functions.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,6 @@ async function onIdentifyBatch(events, settings) {
285285

286286
You cannot configure batch parameters (either in the code or UI) in this version of the beta. Functions waits up to 10 seconds to form a batch of 20 events. If you would like to change your batch parameters, please fill out [this form](https://airtable.com/shr9TU4huO0PK0DSU) and Support will contact you once this is made available.
287287

288-
### Avoid writing batch and single event handlers
289-
290-
Your function might not get enough event traffic to create a batch of short windows of time. In this case, your function invokes the single event handler. If you need to consolidate your code into an `onBatch` handler, you can define single event handlers that call `onBatch`.
291-
292-
```js
293-
async function onTrack(event, settings) {
294-
return onBatch([event], settings)// defer to onBatch
295-
}
296-
297-
async function onIdentify(event, settings) {
298-
return onBatch([event], settings) // defer to onBatch
299-
}
300-
301-
// do the same for onAlias, onGroup, onPage, onScreen, onDelete
302-
303-
async function onBatch(events, settings) {
304-
// handle batch of events
305-
}
306-
```
307-
308288
### Test the batch handler
309289

310290
The [Functions editing environment](/docs/connections/functions/environment/) supports testing batch handlers. In the right panel of the Functions editor, click **customize the event yourself** to enter Manual Mode. Add events as a JSON array, with one event per element. Click **Run** to preview the batch handler with the specified events.

0 commit comments

Comments
 (0)