From 4a7f466ca21f56720344405a6cf100c3ebe72760 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:21:59 -0600 Subject: [PATCH] wip --- .../src/plugins/segmentio/shared-dispatcher.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/browser/src/plugins/segmentio/shared-dispatcher.ts b/packages/browser/src/plugins/segmentio/shared-dispatcher.ts index 3ff584cbe..45dc1a184 100644 --- a/packages/browser/src/plugins/segmentio/shared-dispatcher.ts +++ b/packages/browser/src/plugins/segmentio/shared-dispatcher.ts @@ -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 @@ -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 }