Skip to content
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

Fix calculation of timeout before next change run #180

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

a1exsh
Copy link
Contributor

@a1exsh a1exsh commented Jul 9, 2021

  1. Changes is not a list, but a mapping from name to list of Change objects.
  2. Change with a long timeout should not postpone run of scheduled checks.
  3. A newly added change has to be executed without delay caused by other changes.

Internal ticket: 789

Review

  • Tests
  • Documentation
  • CHANGELOG

1. Changes is not a list, but a mapping from name to list of `Change` objects.
2. Change with a long timeout should not postpone run of scheduled checks.
3. A newly added change has to be executed without delay caused by other changes.
@@ -192,5 +203,6 @@ def _add_change_to_queue(self, change):
def stop(self, change: Change):
_LOG.info('Stopping controller with additional change: {}'.format(change.get_name() if change else None))
# clear all pending changes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was this a TODO comment? I don't see that we clear anything here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be removed

Copy link
Contributor

@antban antban left a comment

Choose a reason for hiding this comment

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

I'm fine to merge as it is right now

time_till_next_run = change.time_till_next_run()
if min_time_till_next_change_run is None:
min_time_till_next_change_run = time_till_next_run
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
else:
elif time_till_next_run is not None:

Copy link
Contributor

Choose a reason for hiding this comment

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

but it's nitpicking feel free to merge as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is semantics of None? The method is not even supposed to return that (not optional).

@@ -192,5 +203,6 @@ def _add_change_to_queue(self, change):
def stop(self, change: Change):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def stop(self, change: Change):
def stop(self, change: Optional[Change]):

Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking again

@@ -192,5 +203,6 @@ def _add_change_to_queue(self, change):
def stop(self, change: Change):
_LOG.info('Stopping controller with additional change: {}'.format(change.get_name() if change else None))
# clear all pending changes
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be removed

@a1exsh
Copy link
Contributor Author

a1exsh commented Jul 9, 2021

👍

1 similar comment
@antban
Copy link
Contributor

antban commented Jul 9, 2021

👍

@a1exsh a1exsh merged commit 93b1745 into master Jul 9, 2021
@a1exsh a1exsh deleted the fix-change-timeout-calc branch July 9, 2021 14:38
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.

None yet

2 participants