mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-06 19:10:54 +01:00
Fix said crash safety
This commit is contained in:
parent
7dac72df79
commit
ebb5e5e60d
1 changed files with 12 additions and 12 deletions
|
@ -223,6 +223,7 @@ export const twitterFetch = async (
|
||||||
newTokenGenerated = true;
|
newTokenGenerated = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
/* If we've generated a new token, we'll cache it */
|
/* If we've generated a new token, we'll cache it */
|
||||||
if (c.executionCtx && newTokenGenerated && activate) {
|
if (c.executionCtx && newTokenGenerated && activate) {
|
||||||
const cachingResponse = new Response(await activate.clone().text(), {
|
const cachingResponse = new Response(await activate.clone().text(), {
|
||||||
|
@ -232,12 +233,11 @@ export const twitterFetch = async (
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('Caching guest token');
|
console.log('Caching guest token');
|
||||||
try {
|
|
||||||
c.executionCtx.waitUntil(cache.put(guestTokenRequestCacheDummy.clone(), cachingResponse));
|
c.executionCtx.waitUntil(cache.put(guestTokenRequestCacheDummy.clone(), cachingResponse));
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error((error as Error).stack);
|
console.error((error as Error).stack);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-expect-error - We'll pin the guest token to whatever response we have
|
// @ts-expect-error - We'll pin the guest token to whatever response we have
|
||||||
response.guestToken = guestToken;
|
response.guestToken = guestToken;
|
||||||
|
|
Loading…
Add table
Reference in a new issue