Skip to content

Commit

Permalink
Make a log before calling callback
Browse files Browse the repository at this point in the history
This might be useful to track down if the callback
might be delayed. Sometimes the test logs report a difference
of a few seconds between natlab receiving the event and telio
emitting it. This commit will allow to narrow it down.

Signed-off-by: Lukas Pukenis <[email protected]>
  • Loading branch information
LukasPukenis committed Jan 20, 2025
1 parent 269f11e commit c6be43d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Empty file added .unreleased/LLT-5950
Empty file.
2 changes: 1 addition & 1 deletion nat-lab/tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async def test_event_content_meshnet(

await client_alpha.set_meshnet_config(api.get_meshnet_config(alpha.id))

# Telio and NatLab both have a sampling rate of 1 second.
# Telio and NatLab both have a sampling rate of 1 second.
# As a result, in the worst case, an event could be delayed by up to 2 seconds.
await client_alpha.wait_for_state_peer(
beta.public_key, [NodeState.DISCONNECTED], [PathType.DIRECT], timeout=2
Expand Down
5 changes: 4 additions & 1 deletion src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,10 @@ impl Device {
.name("libtelio-events".to_owned())
.spawn(move || loop {
match event_rx.blocking_recv() {
Ok(event) => event_cb(event),
Ok(event) => {
telio_log_debug!("EVENT: Just before event callback: {:?}", event);
event_cb(event);
}
Err(RecvError::Lagged(n)) => {
telio_log_warn!("Failed to receive new event, lagged: {n}")
}
Expand Down

0 comments on commit c6be43d

Please sign in to comment.