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

feat: Implement timeout when resolving blocks #106

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

dariusc93
Copy link
Owner

@dariusc93 dariusc93 commented Oct 6, 2023

In the current implementation, we wait an indefinite amount of time for a block to be resolved, which includes asking peers via bitswap, searching over dht for providers, etc., however this is not a desirable behaviour as the node may wish to cancel or abort the event at some point if no block is discovered within a duration.

This PR implements a timeout in Repo::get_block_with_session while it is awaiting on bitswap to perform actions to fetch the block. The Ipfs api will only default to 60 seconds while setting a timeout can be done within IpfsUnixfs, IpfsDag or Repo.

@dariusc93 dariusc93 self-assigned this Oct 6, 2023
@dariusc93 dariusc93 marked this pull request as ready for review October 6, 2023 04:19
@dariusc93 dariusc93 merged commit c0f4709 into libp2p-next Oct 6, 2023
@dariusc93 dariusc93 deleted the feat/cancellable-unixfs branch October 6, 2023 04:19
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.

None yet

1 participant