From fd5a888f185d97c7679dfb724a63b31b6de51638 Mon Sep 17 00:00:00 2001 From: Gnosnay Date: Sun, 3 Nov 2024 22:18:10 +0800 Subject: [PATCH] fix(route/twitter): await when get cache (#17429) --- lib/routes/twitter/api/web-api/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/routes/twitter/api/web-api/utils.ts b/lib/routes/twitter/api/web-api/utils.ts index 0f739c63364e2e..3738f229f70ac7 100644 --- a/lib/routes/twitter/api/web-api/utils.ts +++ b/lib/routes/twitter/api/web-api/utils.ts @@ -14,8 +14,9 @@ import login from './login'; let authTokenIndex = 0; const token2Cookie = async (token) => { - if (cache.get(`twitter:cookie:${token}`)) { - return cache.get(`twitter:cookie:${token}`); + const c = await cache.get(`twitter:cookie:${token}`); + if (c) { + return c; } const jar = new CookieJar(); jar.setCookieSync(`auth_token=${token}`, 'https://x.com');