Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3306683
D13640.id45062.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13640.id45062.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13640: [keyserver] cache findUserIdentities response
Attached
Detach File
Event Timeline
Log In to Comment