-
Notifications
You must be signed in to change notification settings - Fork 213
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(iroh): ActiveRelayActor terminates itself #3061
Conversation
This moves the logic of terminating an ActiveRelayActor from the RelayActor to the ActiveRelayActor itself. This is nice for two reasons: - The interactions between ActiveRelayActor and RelayActor are even simpler. RelayActor logic is now easy to reason about. - It will allow ActiveRelayActor to manage reconnections with exponential backoff better. Currently this behaviour is not changed but the RelayActor getting involved meant the backoff behaviour was influcenced in two places. Now that the ActiveRelayActor lifecyle is much more straight forward the RelayActor's terminating is tidied up as well.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3061/docs/iroh/ Last updated: 2024-12-19T12:50:54Z |
oops, seems the interval change didn't work... |
This kind of shows why I avoided it the first time: it is a lot more complex to use.
Fixed. It kind of shows why I didn't use this the first time round: a lot more complex. |
feel free to go back if you think it is simpler |
It's ok: tests caught it and it still leaves the code clearer to read. I don't think this should be a maintenance burden as this doesn't interact with anything else the actor does. |
// the last datagrams sent to the relay, received datagrams will trigger ACKs which | ||
// is sufficient to keep active connections open. | ||
let mut inactive_timeout = tokio::time::interval(RELAY_INACTIVE_CLEANUP_TIME); | ||
inactive_timeout.reset(); // skip immediate tick |
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.
wouldn't using interval_at
be cleaner? (honest question, not sure it does what you need here)
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.
probably not, gets very verbose again and then i'd prefer the original sleep probably. going to leave this as-is.
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.
one last question, otherwise nice improvements
Description
This moves the logic of terminating an ActiveRelayActor from the
RelayActor to the ActiveRelayActor itself. This is nice for two
reasons:
The interactions between ActiveRelayActor and RelayActor are even
simpler. RelayActor logic is now easy to reason about.
It will allow ActiveRelayActor to manage reconnections with
exponential backoff better. Currently this behaviour is not changed
but the RelayActor getting involved meant the backoff behaviour was
influcenced in two places.
Now that the ActiveRelayActor lifecyle is much more straight forward
the RelayActor's terminating is tidied up as well.
Breaking Changes
Notes & open questions
Change checklist