Some tweaks to maybe make it work better

This commit is contained in:
dangered wolf 2022-08-18 03:58:25 -04:00
parent 7707c0d2d0
commit f49846d4c5
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58

View file

@ -17,6 +17,10 @@ export const fetchUsingGuest = async (
{ {
method: 'POST', method: 'POST',
headers: tokenHeaders, headers: tokenHeaders,
cf: {
cacheEverything: true,
cacheTtl: 300
},
body: '' body: ''
} }
); );
@ -27,7 +31,6 @@ export const fetchUsingGuest = async (
`${Constants.TWITTER_API_ROOT}/1.1/guest/activate.json`, `${Constants.TWITTER_API_ROOT}/1.1/guest/activate.json`,
{ {
method: 'GET', method: 'GET',
headers: tokenHeaders,
cf: { cf: {
cacheEverything: true, cacheEverything: true,
cacheTtl: 300 cacheTtl: 300
@ -145,10 +148,10 @@ export const fetchUsingGuest = async (
newTokenGenerated = true; newTokenGenerated = true;
continue; continue;
} }
console.log('Caching guest token');
/* If we've generated a new token, we'll cache it */ /* If we've generated a new token, we'll cache it */
if (newTokenGenerated) { if (event && newTokenGenerated) {
event && event.waitUntil(cache.put(guestTokenRequestCacheDummy, activate.clone())); console.log('Caching guest token');
event.waitUntil(cache.put(guestTokenRequestCacheDummy, activate.clone()));
} }
conversation.guestToken = guestToken; conversation.guestToken = guestToken;
return conversation; return conversation;