Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3532740
D11848.id39713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11848.id39713.diff
View Options
diff --git a/lib/hooks/login-hooks.js b/lib/hooks/login-hooks.js
--- a/lib/hooks/login-hooks.js
+++ b/lib/hooks/login-hooks.js
@@ -10,7 +10,7 @@
logOutActionTypes,
useIdentityLogOut,
} from '../actions/user-actions.js';
-import { useKeyserverAuth } from '../keyserver-conn/keyserver-auth.js';
+import { useKeyserverAuthWithRetry } from '../keyserver-conn/keyserver-auth.js';
import { logInActionSources } from '../types/account-types.js';
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
@@ -92,7 +92,7 @@
],
);
- const keyserverAuth = useKeyserverAuth(authoritativeKeyserverID());
+ const keyserverAuth = useKeyserverAuthWithRetry(authoritativeKeyserverID());
const isRegisteredOnIdentity = useSelector(
state =>
diff --git a/lib/keyserver-conn/keyserver-auth.js b/lib/keyserver-conn/keyserver-auth.js
--- a/lib/keyserver-conn/keyserver-auth.js
+++ b/lib/keyserver-conn/keyserver-auth.js
@@ -175,14 +175,19 @@
type KeyserverAuthFunc = KeyserverAuthInputs => Promise<void>;
-function useKeyserverAuth(keyserverID: string): KeyserverAuthFunc {
+function useKeyserverAuthWithRetry(keyserverID: string): KeyserverAuthFunc {
const rawKeyserverAuth = useRawKeyserverAuth(keyserverID);
const { callKeyserverEndpoint } = useCallKeyserverEndpointContext();
return React.useCallback(
- (inputs: KeyserverAuthInputs) =>
- rawKeyserverAuth(inputs)(callKeyserverEndpoint),
+ async (inputs: KeyserverAuthInputs) => {
+ try {
+ return await rawKeyserverAuth(inputs)(callKeyserverEndpoint);
+ } catch {
+ return await rawKeyserverAuth(inputs)(callKeyserverEndpoint);
+ }
+ },
[rawKeyserverAuth, callKeyserverEndpoint],
);
}
-export { useRawKeyserverAuth, useKeyserverAuth };
+export { useRawKeyserverAuth, useKeyserverAuthWithRetry };
diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js
--- a/native/account/registration/registration-server-call.js
+++ b/native/account/registration/registration-server-call.js
@@ -12,7 +12,7 @@
deleteAccountActionTypes,
useDeleteDiscardedIdentityAccount,
} from 'lib/actions/user-actions.js';
-import { useKeyserverAuth } from 'lib/keyserver-conn/keyserver-auth.js';
+import { useKeyserverAuthWithRetry } from 'lib/keyserver-conn/keyserver-auth.js';
import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js';
import { isLoggedInToKeyserver } from 'lib/selectors/user-selectors.js';
import {
@@ -308,7 +308,7 @@
// STEP 2: REGISTERING ON AUTHORITATIVE KEYSERVER
- const keyserverAuth = useKeyserverAuth(authoritativeKeyserverID);
+ const keyserverAuth = useKeyserverAuthWithRetry(authoritativeKeyserverID);
const isRegisteredOnIdentity = useSelector(
state =>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 9:47 AM (11 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2705231
Default Alt Text
D11848.id39713.diff (2 KB)
Attached To
Mode
D11848: [lib][native] Automatically retry keyserverAuth during login/registration
Attached
Detach File
Event Timeline
Log In to Comment