Skip to content

Conversation

anisse
Copy link
Contributor

@anisse anisse commented Oct 20, 2025

This should fix the monitoring loop when we are late and make the code a bit easier to read.

@ErwanAliasr1
Copy link
Collaborator

Please explain the issue and the solution in the commit message so our futur "us" will be able to understand this change.
Except that, looks good to me.

This should fix the monitoring loop when we are late and make the code a
bit easier to read.

Before this change, the code would loop indefinitely if an iteration of
the monitoring was late by more than 500ms.

Check that there is still time to run based on the current time, not a
calculation based on the current loop runtime. And return if there is no
time, ignoring the negative sleep time.
Copy link
Collaborator

@ErwanAliasr1 ErwanAliasr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the comment to update, looks good to me

sleep_time = sleep_time_ns / 1e9 # in seconds

if sleep_time_ms < -5:
# The iteration is already late on schedule, no need to sleep
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove the "no need to sleep" as we don't take the decision here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants