From 2760052717617b9a320449f292c7746e0c394933 Mon Sep 17 00:00:00 2001 From: Greg Leonard <45019882+greg-el@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:02:05 +0100 Subject: [PATCH] Rename retryFailures -> retryFailedRequests --- libraries/browser-tracker-core/src/tracker/index.ts | 2 +- .../browser-tracker-core/src/tracker/out_queue.ts | 12 ++++++------ libraries/browser-tracker-core/src/tracker/types.ts | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libraries/browser-tracker-core/src/tracker/index.ts b/libraries/browser-tracker-core/src/tracker/index.ts index af536aa2a..2183981c0 100755 --- a/libraries/browser-tracker-core/src/tracker/index.ts +++ b/libraries/browser-tracker-core/src/tracker/index.ts @@ -304,7 +304,7 @@ export function Tracker( trackerConfiguration.retryStatusCodes ?? [], (trackerConfiguration.dontRetryStatusCodes ?? []).concat([400, 401, 403, 410, 422]), trackerConfiguration.idService, - trackerConfiguration.retryFailures + trackerConfiguration.retryFailedRequests ), // Whether pageViewId should be regenerated after each trackPageView. Affect web_page context preservePageViewId = false, diff --git a/libraries/browser-tracker-core/src/tracker/out_queue.ts b/libraries/browser-tracker-core/src/tracker/out_queue.ts index a2e027fe1..af9b3c017 100644 --- a/libraries/browser-tracker-core/src/tracker/out_queue.ts +++ b/libraries/browser-tracker-core/src/tracker/out_queue.ts @@ -84,7 +84,7 @@ export function OutQueueManager( retryStatusCodes: number[], dontRetryStatusCodes: number[], idService?: string, - retryFailures: boolean = true + retryFailedRequests: boolean = true ): OutQueue { type PostEvent = { evt: Record; @@ -349,11 +349,11 @@ export function OutQueueManager( numberToSend = 1; } - const checkRetryFailures = () => { - if (retryFailures) { + const checkRetryFailedRequests = () => { + if (retryFailedRequests) { LOG.warn(`Request failed, retrying.`); } else { - LOG.error(`Request failed and retryFailures is false, will not retry.`); + LOG.error(`Request failed and retryFailedRequests is false, will not retry.`); removeEventsFromQueue(numberToSend); } executingQueue = false; @@ -363,7 +363,7 @@ export function OutQueueManager( const xhrTimeout = setTimeout(function () { xhr.abort(); - checkRetryFailures(); + checkRetryFailedRequests(); }, connectionTimeout); const removeEventsFromQueue = (numberToSend: number): void => { @@ -391,7 +391,7 @@ export function OutQueueManager( } if (xhr.status === 0) { - checkRetryFailures(); + checkRetryFailedRequests(); return; } diff --git a/libraries/browser-tracker-core/src/tracker/types.ts b/libraries/browser-tracker-core/src/tracker/types.ts index 6bc42a3fe..20a7ce390 100755 --- a/libraries/browser-tracker-core/src/tracker/types.ts +++ b/libraries/browser-tracker-core/src/tracker/types.ts @@ -249,7 +249,6 @@ export type TrackerConfiguration = { * The request respects the `anonymousTracking` option, including the SP-Anonymous header if needed, and any additional custom headers from the customHeaders option. */ idService?: string; - /** * Whether to retry failed requests to the collector. * @@ -260,7 +259,7 @@ export type TrackerConfiguration = { * * @defaultValue true */ - retryFailures?: boolean; + retryFailedRequests?: boolean; }; /**