-
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
Feat: mpsc channel #125
base: main
Are you sure you want to change the base?
Feat: mpsc channel #125
Conversation
let data_lock = state.lock().unwrap(); | ||
let pulses = &data_lock.pulses; | ||
assert!(pulses.len() == 0); | ||
sleep(Duration::from_millis(7000)).await; |
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 is quite a lot of waiting, why is that? and why did you need to increase it?
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 test actually connects to drand's gossipsub. Waiting 7 seconds ensure we get enough pulses. It's probably not necessary to wait that long but it provides a strong guarantee that we would have consumed at least two messages from the topic.
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.
Is this something that we could do with a mock?
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.
It can be mocked, but I still think it's good to have an e2e test that consumes from the real drand.
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.
@driemworks looks good overall imo. Nice tests, my only comment would be to differentiate those tests with actual dependency to the drand network to be more like integration or e2e tests
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. The tarpaulin stuff has been removed in the most recent PR.
@colemanirby Gotcha, I removed the changes to the tarpaulin config. |
This replaces the
SharedState
struct with an mpsc channel, where it uses aTracingUnboundedSender
to write well-formatted pulses from the gossipsub topic. Pulses can be read with a correspondingTracingUnboundedReceiver
update tarpaulin config to output html reports and update gitignore to ignore it