From 09487bdbec5df21626472ca37f377995f7229e07 Mon Sep 17 00:00:00 2001 From: Esteban Galvis Date: Mon, 29 Jun 2026 08:36:40 -0500 Subject: [PATCH] fix: update token scheduler to use dynamic expiration and renewal intervals --- .../auth/refresh-token/create-token-schedule-with-retry.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts b/src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts index 201326a3cd..ed5a55b485 100644 --- a/src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts +++ b/src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts @@ -5,10 +5,13 @@ import { logger } from '@internxt/drive-desktop-core/build/backend'; import { refreshToken } from './refresh-token'; const CREATE_SCHEDULE_RETRY_LIMIT = 3; +const TOKEN_EXPIRATION_HOURS = 12; +const TOKEN_RENEW_INTERVAL_HOURS = 4; +const TOKEN_RENEW_BEFORE_EXPIRATION_DAYS = (TOKEN_EXPIRATION_HOURS - TOKEN_RENEW_INTERVAL_HOURS) / 24; export async function createTokenScheduleWithRetry() { const { newToken } = getCredentials(); - const tokenScheduler = new TokenScheduler(5, newToken, closeUserSession); + const tokenScheduler = new TokenScheduler(TOKEN_RENEW_BEFORE_EXPIRATION_DAYS, newToken, closeUserSession); let attempt = 0; while (attempt < CREATE_SCHEDULE_RETRY_LIMIT) {