Page MenuHomePhabricator

D13640.id45062.diff
No OneTemporary

D13640.id45062.diff

diff --git a/keyserver/src/updaters/thread-updaters.js b/keyserver/src/updaters/thread-updaters.js
--- a/keyserver/src/updaters/thread-updaters.js
+++ b/keyserver/src/updaters/thread-updaters.js
@@ -935,9 +935,7 @@
threadID: string,
communityFarcasterChannelTag: string,
): Promise<string | null> {
- const response = await findUserIdentities([viewer.userID]);
-
- const { farcasterID } = response.identities[viewer.userID];
+ const farcasterID = await getUserFarcasterID(viewer.userID);
if (!farcasterID) {
return null;
@@ -961,6 +959,22 @@
return null;
}
+async function getUserFarcasterID(userID: string): Promise<?string> {
+ const cachedUserIdentity = await redisCache.getUserIdentity(userID);
+ if (cachedUserIdentity) {
+ return cachedUserIdentity.farcasterID;
+ }
+
+ const response = await findUserIdentities([userID]);
+ const userIdentity = response.identities[userID];
+ if (!userIdentity) {
+ return null;
+ }
+
+ ignorePromiseRejections(redisCache.setUserIdentity(userID, userIdentity));
+ return userIdentity.farcasterID;
+}
+
async function userLeadsChannel(
communityFarcasterChannelTag: string,
farcasterID: string,

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 9:20 PM (21 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540478
Default Alt Text
D13640.id45062.diff (1 KB)

Event Timeline