Skip to content

Commit

Permalink
Rename retryFailures -> retryFailedRequests
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-el committed Oct 23, 2023
1 parent c213949 commit 2760052
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libraries/browser-tracker-core/src/tracker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions libraries/browser-tracker-core/src/tracker/out_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function OutQueueManager(
retryStatusCodes: number[],
dontRetryStatusCodes: number[],
idService?: string,
retryFailures: boolean = true
retryFailedRequests: boolean = true
): OutQueue {
type PostEvent = {
evt: Record<string, unknown>;
Expand Down Expand Up @@ -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;
Expand All @@ -363,7 +363,7 @@ export function OutQueueManager(
const xhrTimeout = setTimeout(function () {
xhr.abort();

checkRetryFailures();
checkRetryFailedRequests();
}, connectionTimeout);

const removeEventsFromQueue = (numberToSend: number): void => {
Expand Down Expand Up @@ -391,7 +391,7 @@ export function OutQueueManager(
}

if (xhr.status === 0) {
checkRetryFailures();
checkRetryFailedRequests();
return;
}

Expand Down
3 changes: 1 addition & 2 deletions libraries/browser-tracker-core/src/tracker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -260,7 +259,7 @@ export type TrackerConfiguration = {
*
* @defaultValue true
*/
retryFailures?: boolean;
retryFailedRequests?: boolean;
};

/**
Expand Down

0 comments on commit 2760052

Please sign in to comment.