-
Notifications
You must be signed in to change notification settings - Fork 88
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
refactor(composer): interact with executor through handle #834
Conversation
650bf69
to
f27fc69
Compare
ec91a39
to
6a053e9
Compare
6a053e9
to
bbf53b7
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 and is ready to merge after addressing the privacy issue around executor::Handle
- it doesn't make sense allowing the construction of a handle to a thing that does not exist.
} | ||
|
||
impl Handle { | ||
pub(super) fn new(serialized_rollup_transactions_tx: mpsc::Sender<SequenceAction>) -> Self { |
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 constructor should not be pub(super)
- it should only be callable from inside this module
(Very minor nit: I don't think this needs an explicit constructor - just create the handle in Executor::new
(or however it's constructor is called).)
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.
i think thats a good point. i ll try just creating it in the Executor::new
} | ||
} | ||
|
||
pub(super) async fn send_with_timeout( |
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.
i like the thin wrapper - but IMO just call this send_timeout
.
@@ -89,7 +90,7 @@ pub(super) struct Executor { | |||
// The status of this executor | |||
status: watch::Sender<Status>, | |||
// Channel for receiving `SequenceAction`s to be bundled. | |||
serialized_rollup_transactions_rx: mpsc::Receiver<SequenceAction>, | |||
sequence_action_rx: mpsc::Receiver<SequenceAction>, |
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.
Personally, I'd just call this sequence_actions
or new_sequence_actions. The
_rx` doesn't add anything of substance.
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.
i ll call it serialized_rollup_transactions
just to keep the naming consistent.
aa22f69
to
a3a06a8
Compare
@@ -238,11 +238,11 @@ impl Geth { | |||
/// # Errors | |||
/// | |||
/// Returns the same error as tokio's [`Sender::send`]. | |||
pub fn abort(&self) -> Result<usize, SendError<SubscriptionCommand>> { | |||
pub fn cancel_subscriptions(&self) -> Result<usize, SendError<SubscriptionCommand>> { |
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.
Yeah, this is more descriptive. I was confused by abort
.
a3a06a8
to
8e0da40
Compare
20f99e6
to
d7ee826
Compare
d7ee826
to
7e225cb
Compare
Summary
This is a minor refactor PR which moves the creation of the channel through which executor receives SequenceActions to submit to the Shared Sequence N/w to the executor.
Background
Previously, the channels were created by the Composer which creates the Executor. It is better practice to allow the Executor to create the channel which it owns and just return the sending end of it back to the Composer.
Changes
Handle
in Executor which is referenced asexecutor::Handle
.executor::Handle
in Executor and allow Executor to pass it back.Testing
Since this is not a functional PR change, making sure that the code compiles and the tests run is enough to ensure that this works.
Note
The tests were initially using just
send
on the channel but the executor usessend_with_timeout
. We could add just asend
method to theexecutor::Handle
. But to avoid clippy errors w.r.t unused methodsend
and avoiding a#[cfg(test)]
in the method, I updated the tests to usesend_with_timeout
instead ofsend
.closes