From f351ad821bec2262163b9f17d276b3d70b2eb27d Mon Sep 17 00:00:00 2001 From: David Leek Date: Mon, 26 Feb 2024 14:32:56 +0100 Subject: [PATCH] chore: set proxy-repo interval to 45mins instead of 20secs (#6340) Since we're polling for updates to max revision id every second, and listening for update events for revision id in the proxy repository then running a refresh interval of 20secs in the proxy repo refresh seems excessive. This PR changes the frequency of the refresh to once per 45mins. --- src/lib/__snapshots__/create-config.test.ts.snap | 2 +- src/lib/create-config.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 1319d83d6e..713d0c8b2e 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -148,7 +148,7 @@ exports[`should create default config 1`] = ` }, }, "frontendApi": { - "refreshIntervalInMs": 20000, + "refreshIntervalInMs": 2700000, }, "frontendApiOrigins": [ "*", diff --git a/src/lib/create-config.ts b/src/lib/create-config.ts index 661efe1450..597aafd33c 100644 --- a/src/lib/create-config.ts +++ b/src/lib/create-config.ts @@ -24,7 +24,11 @@ import { import { getDefaultLogProvider, LogLevel, validateLogProvider } from './logger'; import { defaultCustomAuthDenyAll } from './default-custom-auth-deny-all'; import { formatBaseUri } from './util/format-base-uri'; -import { hoursToMilliseconds, secondsToMilliseconds } from 'date-fns'; +import { + hoursToMilliseconds, + minutesToMilliseconds, + secondsToMilliseconds, +} from 'date-fns'; import EventEmitter from 'events'; import { ApiTokenType, @@ -514,7 +518,7 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig { const frontendApi = options.frontendApi || { refreshIntervalInMs: parseEnvVarNumber( process.env.FRONTEND_API_REFRESH_INTERVAL_MS, - 20000, + minutesToMilliseconds(45), ), };