diff --git a/engage-api/get-activity.ts b/engage-api/get-activity.ts index ce0f3d2..1a6b982 100644 --- a/engage-api/get-activity.ts +++ b/engage-api/get-activity.ts @@ -45,6 +45,7 @@ async function getCompleteCookies(userName: string, userPwd: string): Promise= 500 && error.response.status < 600) { + logger.error(`Server error ${error.response.status} - preserving local cache, not updating.`); + } } if (attempt === maxRetries - 1) { logger.error(`All ${maxRetries} retries failed for activity ${activityId}.`); diff --git a/services/cache-manager.ts b/services/cache-manager.ts index f6e85ca..feb3f89 100644 --- a/services/cache-manager.ts +++ b/services/cache-manager.ts @@ -72,9 +72,10 @@ let skippedCount = 0; /** * Process and cache a single activity * @param activityId - The activity ID to process + * @param forceUpdate - If true, update cache even on fetch failure (default: false) * @returns The processed activity data */ -async function processAndCacheActivity(activityId: string): Promise { +async function processAndCacheActivity(activityId: string, forceUpdate: boolean = false): Promise { logger.debug(`Processing activity ID: ${activityId}`); try { if (!USERNAME || !PASSWORD) { @@ -92,11 +93,21 @@ async function processAndCacheActivity(activityId: string): Promise