Skip to content
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

Merged
merged 4 commits into from
Apr 30, 2024

Conversation

juanmahidalgo
Copy link
Contributor

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

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marketplace ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 10:25am

@coveralls
Copy link

coveralls commented Apr 29, 2024

Coverage Status

coverage: 66.854% (+0.1%) from 66.747%
when pulling ea38887 on fix/infinite-waiting-on-mm-blocked
into 4e28e17 on master.

})) 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 }
Copy link
Contributor

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:

Suggested change
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: any }
})) as { success: ConnectWalletSuccessAction; failure: ConnectWalletFailureAction; timeout: undefined }

If I'm not wrong, it should return undefined

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)
Copy link
Contributor

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
Copy link
Contributor

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?

@juanmahidalgo juanmahidalgo merged commit eb46453 into master Apr 30, 2024
9 checks passed
@juanmahidalgo juanmahidalgo deleted the fix/infinite-waiting-on-mm-blocked branch April 30, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants