Skip to content

Commit

Permalink
fix(twitter): cache unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Oct 15, 2024
1 parent 2de569b commit bf2e71c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/routes/twitter/api/web-api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ export const twitterGot = async (
logger.debug(`twitter debug: delete twitter cookie for token ${auth.token} with status ${response.status}, remaining tokens: ${config.twitter.authToken?.length}`);
await cache.set(`${lockPrefix}${auth.token}`, '1', 86400);
}
} else {
logger.debug(`twitter debug: unlock twitter cookie with success for token ${auth.token}`);
await cache.set(`${lockPrefix}${auth.token}`, '', 1);
}
}
},
Expand All @@ -205,8 +208,6 @@ export const twitterGot = async (
if (auth?.token) {
logger.debug(`twitter debug: update twitter cookie for token ${auth.token}`);
await cache.set(`twitter:cookie:${auth.token}`, JSON.stringify(dispatchers?.jar.serializeSync()), config.cache.contentExpire);
logger.debug(`twitter debug: unlock twitter cookie with success for token ${auth.token}`);
await cache.set(`${lockPrefix}${auth.token}`, '', 1);
}

return response._data;
Expand Down

0 comments on commit bf2e71c

Please sign in to comment.