-
Notifications
You must be signed in to change notification settings - Fork 117
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
change(state): Remove active_value
field from ChainTipSender
#4175
Conversation
active_value
field from ChainTipSender
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 looks good, have you run a full sync test to check for locking bugs?
I ran the unit tests and I started the full sync test but only ran for a few minutes to check if the chain tip was being updated. I can't run more than that locally because I'm having some internet issues :( |
@Mergifyio update |
✅ Branch has been successfully updated |
Record the fields using a helper method. This reduces duplicate code and prepares for removing the `active_value` field from the type, because the replacement for it has to be atomically read to avoid a deadlock when reading from the `watch::Sender` endpoint.
Now that Tokio has been updated to a version in which `watch::Sender` has a `borrow` method, we can remove the `active_value` field. To prevent a deadlock like the one that happened with the synchronizer some time ago, the method instrumentation was slightly refactored to have the fields recorded in helper methods that avoid obtaining a read-lock twice.
They are resolved with the current changes.
This is a minor optimization to remove an unnecessary second call to `tracing::Span::current()`.
Explain why a binding can't be created for the old tip reference.
9bf6c07
to
4e871e5
Compare
Does this close #2573? |
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.
Thanks!
Motivation
The
ChainTipSender
type had an extra field as a workaround to when Zebra was using an older version of Tokio that didn't have thewatch::Sender::borrow()
method. Zebra now depends on a newer version of Tokio, so that field can be removed.This was a cleanup I did some time ago, and I was afraid I'd forget to push this.
Depends-On: #4198
Solution
Remove the field, replacing the usages with
watcher::Sender::borrow()
.As part of the changes, I also simplified the instrumentation attribute a bit.
Review
Reviewer Checklist
Follow Up Work