-
Notifications
You must be signed in to change notification settings - Fork 2
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(cardano-chain-follower): Refactor cardano-chain-follower to fix client concurrency bug #182
Conversation
51d5f66
to
67bb328
Compare
…lient concurrency bug
…read block and read block range futures
97fe020
to
3357f0a
Compare
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.
Looks good to me. Quite clear after taking a look at the code after the last tech discussion. Just a few grammar error (:
hermes/crates/cardano-chain-follower/examples/set_read_pointer.rs
Outdated
Show resolved
Hide resolved
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.
LGTM, added suggestions for the grammar issues @bkioshn already mentioned.
hermes/crates/cardano-chain-follower/examples/set_read_pointer.rs
Outdated
Show resolved
Hide resolved
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.
LGTM
Description
This PR fixes a bug that caused the
Follower
to get stuck when trying to set its read pointer while waiting for the next chain update.Related Issue(s)
Closes #180
Description of Changes
Background task
Follower
background task refactored to allow dropping the client and recreating it when setting the read pointer (which is needed because there seems to be no way of aborting an ongoing request to the node)read_block and read_block_range
Follower::read_block
andFollower::read_block_range
now spawn futures and return join handles to make it possible to make read requests concurrently while not depending on the follower's background task.New examples
set_read_pointer
example that shows changing the follower's read pointer while following the chainconcurrent_reads
example that shows how to read chain blocks concurrentlyBreaking Changes
Error
type were renamed/removedReadBlock
andReadBlockRange
implementFuture
and should be awaited directly, i.e.:follower.read_block().await
instead offollower.read_block().read().await
Please confirm the following checks