Refactor: Reduce rate-limit TTL to 25 hours

This commit is contained in:
2026-02-15 11:00:07 -08:00
parent 606feec0ff
commit 0cbcc73326

View File

@@ -62,9 +62,10 @@ export async function onRequest(context) {
}
// Write a unique rate key BEFORE doing the search (claim the slot)
// TTL of 25 hours is enough to cover the remainder of the UTC day
const rateEntryKey = `${ratePrefix}${Date.now()}-${crypto.randomUUID()}`;
await env.DIRECT_IMG_RATE.put(rateEntryKey, "1", {
expirationTtl: 48 * 60 * 60,
expirationTtl: 25 * 60 * 60,
});
// Notify of a new search (Cache Miss)