-
Notifications
You must be signed in to change notification settings - Fork 24
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 batcher and inline into SessionKeeper #1036
base: main
Are you sure you want to change the base?
Conversation
3678fc7
to
002eaa4
Compare
002eaa4
to
b3979cf
Compare
b3979cf
to
5e49bb5
Compare
5e49bb5
to
2d34b68
Compare
2d34b68
to
b73a4ea
Compare
b73a4ea
to
c61628a
Compare
c61628a
to
03ce6e3
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.
.await | ||
.map_err(Error::Task)? | ||
.map_err(Error::RepeatedActionError) | ||
.map(|_| ())?; |
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.
.map(|_| ())?;
I think this is a no-op and can be removed
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.
You're right, removed it. Probably previously it was inlined directly into Ok()
so it made sense
.unwrap(); | ||
ctx.actions.select_action().await.unwrap().1(&mut ctx) | ||
.await | ||
.unwrap(); |
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.
Why special case for ts_10 and ts_13? You can just add them to the vector and loop 6 times instead of 4
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.
You're right about these testcases. I tried to be very explicit but now reading it it gives me impression that it's totally unecessary so I went along with your suggestions and inlined it effectively converting the case to just a vector and a loop :)
.unwrap(); | ||
|
||
assert_eq!(ctx.get(), values_to_expect.pop().unwrap()); | ||
} |
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.
Maybe just:
let values_to_expect = vec!["ts_10", "ts_13", "ts_20", "ts_23", "ts_30", "ts_33"];
for time in values_to_expect {
ctx.actions.select_action().await.unwrap().1(&mut ctx)
.await
.unwrap();
assert_eq!(ctx.get(), time);
}
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.
did so 👍
.unwrap(); | ||
|
||
assert_eq!(ctx.get(), values_to_expect.pop().unwrap()); | ||
} |
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.
Same here
src/device/wg_controller.rs
Outdated
"actual_keys: {}, requested_keys: {}", | ||
actual_peers.keys().len(), | ||
requested_peers.keys().len(), | ||
); |
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.
Leftover from debugging?
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.
Good catch, thanks!
src/device/wg_controller.rs
Outdated
telio_log_debug!( | ||
"Will insert with keepalive of {:?}", | ||
persistent_keepalive_interval | ||
); |
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.
Also look like some leftover?
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.
Removed it, it was a leftover
This commit does these things: - Inlines batching flag to SessionKeeper, removing batcher entirely as a separate entity with all of its logic(threshold, traffic trigger). - Emits all actions from SessionKeeper if batching is enabled when an action is added. This works nicely if we can guarantee that actions are gonna be a multiple of some T which is the case as currently we target T=70s for proxy, direct, vpn, stun keepalives. This also makes thresholds and the whole logic around them irrelevant. Traffic triggered batching implementation was doing more harm than good since it triggers on _any_ traffic, meaning even when alignment was achieved, it might misalign since any traffic triggers it. Feature flags are not removed in this commit so not to push for version update of libtelio, so now they are no-op. Signed-off-by: Lukas Pukenis <[email protected]> Signed-off-by: Lukas Pukenis <[email protected]>
03ce6e3
to
613ca6a
Compare
Problem
--describe problem being solved--
Solution
--describe selected solution--
☑️ Definition of Done checklist