Page MenuHomePhabricator

D12356.id41176.diff
No OneTemporary

D12356.id41176.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,11 @@
return assertWithValidator(identities, identitiesValidator);
};
+
+ ping: () => Promise<void> = async () => {
+ const client = this.unauthClient;
+ await client.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, 4:12 AM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2679461
Default Alt Text
D12356.id41176.diff (3 KB)

Event Timeline