Skip to content

Commit

Permalink
add exponential backoff for axios retries
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Dec 20, 2023
1 parent 4c693e9 commit d000ddc
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/map/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { DivIcon, Map } from 'leaflet';
import Time from 'svelte-time';
import { get } from 'svelte/store';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

export const toggleMapButtons = () => {
const zoomInBtn: HTMLAnchorElement | null = document.querySelector('.leaflet-control-zoom-in');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sync/areas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import localforage from 'localforage';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const limit = 500;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/sync/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axiosRetry from 'axios-retry';
import localforage from 'localforage';
import { get } from 'svelte/store';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const limit = 5000;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/sync/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import localforage from 'localforage';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const limit = 50000;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/sync/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import localforage from 'localforage';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const limit = 20000;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/sync/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import localforage from 'localforage';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const limit = 7500;

Expand Down
2 changes: 1 addition & 1 deletion src/routes/add-location/endpoint/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const used: string[] = [];
// @ts-expect-error
Expand Down
2 changes: 1 addition & 1 deletion src/routes/boost/invoice/generate/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { error } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

// generate and return invoice
// @ts-expect-error
Expand Down
2 changes: 1 addition & 1 deletion src/routes/boost/post/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { error, json } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const used: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/routes/communities/add/endpoint/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const used: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/routes/community/[area]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { error } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

// @ts-expect-error
export async function load({ params }) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/merchant/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
!dataInitialized &&
initializeData();
axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });
let merchant: Element | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/merchant/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { error } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

// @ts-expect-error
export async function load({ params }) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/tagger/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { error } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

// @ts-expect-error
export async function load({ params }) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/tickets/endpoint/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { json } from '@sveltejs/kit';
import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

export async function GET() {
const headers = {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/verify-location/endpoint/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';

axiosRetry(axios, { retries: 3 });
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });

const used: string[] = [];

Expand Down

0 comments on commit d000ddc

Please sign in to comment.