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

E2E: Consistent and configurable timeouts #797

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

noaccOS
Copy link
Contributor

@noaccOS noaccOS commented Jun 9, 2023

Sample implementation for #487.

Timeout is now handled by the scheduler instead of happening directly in the service notifier.

Timeouts can be declared as a number of failed checks or as the number of seconds passed, both only affecting the startup. At least one check has to be done because otherwise the timeout would be triggered even in a perfectly working condition. It is not possible to disable timeouts for now, but could be addressed relatively easily if needed.

Timeouts are always called right after a check, even when declared as a time span, because the state wouldn't change anyway and it makes it easier to schedule the timeout exactly. If the check happens every 5s and the timeout is set at 10, it will always be called after exactly two checks. This would not be guaranteed by a simple Process.send_after(self(), :timeout, timeout_s), as check calls may take a bit more milliseconds than an exact check_interval_ms.

If declaring the timeout at the exact second it was requested, we must check that both the declared amount of seconds has passed and div(timeout_s, check_interval_s) checks have been made, but as I said I have only implemented the required number of checks for now.

As a side note, now consequent checks are scheduled immediately instead of waiting for the previous check to end (5cdb1ff). This might be outside the scope of this pr but I'll leave it here for now, as I believe fixing the scheduling is the scope of this pr.

Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
Doing this makes timing more consistent, executing a check approximately
every check_interval_ms milliseconds.

Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
@noaccOS noaccOS changed the title Consistent and configurable timeouts E2E: Consistent and configurable timeouts Jun 12, 2023
Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
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

1 participant