Page MenuHomePhabricator

D12356.id41174.diff
No OneTemporary

D12356.id41174.diff

diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -195,6 +195,9 @@
+linkFarcasterAccount: (farcasterID: string) => Promise<void>;
+unlinkFarcasterAccount: () => Promise<void>;
+findUserIdentities: (userIDs: $ReadOnlyArray<string>) => Promise<Identities>;
+ // We are introducing this on web temporarily to make sure the identity
+ // service is reachable in production
+ +ping?: () => Promise<void>;
}
export type IdentityServiceAuthLayer = {
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -51,6 +51,7 @@
import { MemberListSidebarProvider } from './chat/member-list-sidebar/member-list-sidebar-provider.react.js';
import CommunitiesRefresher from './components/communities-refresher.react.js';
import { DBOpsHandler } from './components/db-ops-handler.react.js';
+import IdentityPing from './components/identity-ping.react.js';
import LogOutIfMissingCSATHandler from './components/log-out-if-missing-csat-handler.react.js';
import NavigationArrows from './components/navigation-arrows.react.js';
import MinVersionHandler from './components/version-handler.react.js';
@@ -238,6 +239,7 @@
<InviteLinksRefresher />
<CommunitiesRefresher />
<MinVersionHandler />
+ <IdentityPing />
<PlatformDetailsSynchronizer />
<LogOutIfMissingCSATHandler />
<UserInfosHandler />
diff --git a/web/components/identity-ping.react.js b/web/components/identity-ping.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/identity-ping.react.js
@@ -0,0 +1,40 @@
+// @flow
+
+import * as React from 'react';
+
+import { IdentityClientContext } from 'lib/shared/identity-client-context.js';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
+
+function IdentityPing(): React.Node {
+ const identityContext = React.useContext(IdentityClientContext);
+ const isCurrentUserStaff = useIsCurrentUserStaff();
+
+ const ping = React.useCallback(async () => {
+ try {
+ if (!identityContext) {
+ console.log('Identity context not available');
+ return;
+ }
+ const identityClient = identityContext.identityClient;
+ const pingCall = identityClient.ping;
+ if (!pingCall) {
+ console.log('Ping method unimplemented');
+ return;
+ }
+ await pingCall();
+ if (isCurrentUserStaff) {
+ console.log('Identity ping successful');
+ }
+ } catch (error) {
+ console.log('Error pinging identity service:', error);
+ }
+ }, [identityContext, isCurrentUserStaff]);
+
+ React.useEffect(() => {
+ void ping();
+ }, [ping]);
+
+ return null;
+}
+
+export default IdentityPing;
diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js
--- a/web/grpc/identity-service-client-wrapper.js
+++ b/web/grpc/identity-service-client-wrapper.js
@@ -667,6 +667,8 @@
return assertWithValidator(identities, identitiesValidator);
};
+
+ ping: () => Promise<void> = () => this.unauthClient.ping(new Empty());
}
function authNewDeviceKeyUpload(
diff --git a/web/grpc/identity-service-context-provider.react.js b/web/grpc/identity-service-context-provider.react.js
--- a/web/grpc/identity-service-context-provider.react.js
+++ b/web/grpc/identity-service-context-provider.react.js
@@ -139,6 +139,7 @@
linkFarcasterAccount: proxyMethodToWorker('linkFarcasterAccount'),
unlinkFarcasterAccount: proxyMethodToWorker('unlinkFarcasterAccount'),
findUserIdentities: proxyMethodToWorker('findUserIdentities'),
+ ping: proxyMethodToWorker('ping'),
};
}, [proxyMethodToWorker]);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 2:33 AM (19 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2679860
Default Alt Text
D12356.id41174.diff (3 KB)

Event Timeline