mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 20:33:44 -07:00
oh yeah
This commit is contained in:
parent
984dc04ee8
commit
44d74806d7
1 changed files with 22 additions and 8 deletions
|
|
@ -495,21 +495,35 @@ export async function getFeedMapping(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If jsonString is still null/empty after checks, the key wasn't found
|
||||||
if (!jsonString) {
|
if (!jsonString) {
|
||||||
console.log(`[getFeedMapping] Key ${feedId} (and compressed variant) not found on any checked instance.`);
|
console.log(`[getFeedMapping] Key ${feedId} (and compressed variant) not found on any checked instance.`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset expiration on access (only if found via regular key initially or synced from replica)
|
// --- Reset TTL for the regular key now that we have its value ---
|
||||||
console.log(`[getFeedMapping] Resetting TTL for regular key ${regularKey} on ${clientName}`);
|
console.log(`[getFeedMapping] Resetting TTL for regular key ${regularKey} on ${clientName}`);
|
||||||
await client.expire(regularKey, DEFAULT_CACHE_TTL);
|
// Use try-catch for the expire call to prevent it from stopping data return if expire fails
|
||||||
|
try {
|
||||||
|
// Reset TTL on the client instance we initially connected to
|
||||||
|
await client.expire(regularKey, DEFAULT_CACHE_TTL);
|
||||||
|
} catch (expireError) {
|
||||||
|
console.warn(`[getFeedMapping] Failed to reset TTL for regular key ${regularKey} on ${clientName}:`, expireError);
|
||||||
|
}
|
||||||
|
// --- End TTL Reset ---
|
||||||
|
|
||||||
|
// Parse the result (jsonString has the data from either initial client or replica)
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(jsonString); // Removed 'as string' for potentially better type safety if needed
|
||||||
|
return {
|
||||||
|
slugs: data.slugs,
|
||||||
|
lang: data.lang
|
||||||
|
};
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error(`[getFeedMapping] CRITICAL ERROR parsing feed mapping JSON for ${feedId}:`, parseError, `JSON String: ${jsonString}`);
|
||||||
|
return null; // Return null if parsing fails
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the result
|
|
||||||
const data = JSON.parse(jsonString as string);
|
|
||||||
return {
|
|
||||||
slugs: data.slugs,
|
|
||||||
lang: data.lang
|
|
||||||
};
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[getFeedMapping] CRITICAL ERROR retrieving feed mapping for ${feedId}:`, error);
|
console.error(`[getFeedMapping] CRITICAL ERROR retrieving feed mapping for ${feedId}:`, error);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue