-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add timeout when MM active method hangs #2240
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
webapp/src/modules/wallet/utils.ts
Outdated
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction } | ||
failure: take(CONNECT_WALLET_FAILURE), | ||
timeout: delay(WAIT_FOR_WALLET_CONNECTION_TIMEOUT) // 10 seconds timeout | ||
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: any } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind typing the return of delay? We don't have the linter rule available for it yet, but typing it would help on the changes we need to do:
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: any } | |
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: undefined } |
If I'm not wrong, it should return undefined
webapp/src/modules/wallet/utils.ts
Outdated
failure: take(CONNECT_WALLET_FAILURE), | ||
timeout: delay(WAIT_FOR_WALLET_CONNECTION_TIMEOUT) // 10 seconds timeout | ||
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: any } | ||
console.log('timeout: ', timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind removing the console log?
it('should finish waiting after the timeout', () => { | ||
return expectSaga(waitForWalletConnectionAndIdentityIfConnecting) | ||
.provide([[select(isConnecting), true]]) | ||
.delay(10000) // Simulate a delay longer than the timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should make the test take at least 10 seconds. What if we mock in the provide the delay so it executes instantly?
When MM is blocked, this saga keeps waiting for ever since it won't succed or failed. This PR adds a timeout to avoid that