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: await result of receiving blocks #213

Merged
merged 1 commit into from
Feb 10, 2020

Conversation

achingbrain
Copy link
Member

bitswap._receiveMessage is an async function so you need to await on it in order to correctly handle any errors encountered.

I've been seeing unhandledPromiseRejection events during test runs, turns out it's when you spin up two nodes, get them to dial each other and transfer data - the tests can shut the nodes down and clean up their repos before they've finished processing incoming blocks leading to Error: ENOENT: no such file or directory errors as the repos are deleted out from under the blockstore.

awaiting on the result of bitswap._receiveMessage fixes this by handling the error.

`bitswap._receiveMessage` is an async function so you need to `await` on it in order to correctly handle any errors encountered.

I've been seeing `unhandledPromiseRejection` events during test runs, turns out it's when you spin up two nodes, get them to dial each other and transfer data - the tests can shut the nodes down and clean up their repos before they've finished processing incoming blocks leading to `Error: ENOENT: no such file or directory` errors as the repos are deleted out from under the blockstore.

`await`ing on the result of `bitswap._receiveMessage` fixes this by handling the error.
Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@dirkmc dirkmc merged commit dae48dd into master Feb 10, 2020
@dirkmc dirkmc deleted the fix-unhandled-promise-rejection branch February 10, 2020 21:27
@dirkmc
Copy link
Contributor

dirkmc commented Feb 10, 2020

Thanks!

Landed in v0.27.1 🚀

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.

2 participants