Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Dec 18, 2024
1 parent d1399f4 commit 4a7f466
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/browser/src/plugins/segmentio/shared-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface DispatchConfig {
/**
* This is useful for ensuring that an event is sent even if the user navigates away from the page.
* However, it may increase the likelihood of events being lost, as there is a 64kb limit for *all* fetch requests (not just ones to segment) with keepalive (which is why it's disabled by default). So, if you're sending a lot of data, this will likely cause events to be dropped.
* @default false
*/
keepalive?: boolean
Expand All @@ -41,8 +42,25 @@ interface DispatchConfig {
}

export interface BatchingDispatchConfig extends DispatchConfig {
/**
* The maximum number of events to send in a single request. If the batch reaches this size, a request will automatically be sent.
*
* @default 10
*/
size?: number
/**
* The maximum time, in milliseconds, to wait before sending a request.
* This won't alaways be relevant, as the request will be sent when the size is reached.
* However, if the size is never reached, the request will be sent after this time.
* When it comes to retries, if there is a rate limit timeout header, that will be respected over the value here.
*
* @default 5000
*/
timeout?: number
/**
* The maximum number of retries to attempt before giving up.
* @default 10
*/
maxRetries?: number
}

Expand Down

0 comments on commit 4a7f466

Please sign in to comment.