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

Add jitter to sleep #39

Merged
merged 9 commits into from
Aug 15, 2023
Merged

Add jitter to sleep #39

merged 9 commits into from
Aug 15, 2023

Conversation

ashi009
Copy link
Contributor

@ashi009 ashi009 commented Aug 11, 2023

Add sleep-jitter config/flag to sleep. So when deployed in large scale, this will reduce the likelihood for
having all the servers banning the remote endpoint at once.

In this change runChan is replaced with a lambda function runOnce, which is a non-blocking function
to trigger a single run, and it returns if ansible is running already. Which removes the possibility that multiple
ansible runs queued up and runs back to back.

When sleep jitter is specified, the puller will sleep a duration that conforms to uniform distribution
U(sleep-jitter, sleep+jitter). Otherwise the behavior remains unchanged.

Copy link
Contributor

@jyates jyates left a comment

Choose a reason for hiding this comment

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

Would be good to have @shk3 take a pass over it too

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
http.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@shk3 shk3 merged commit d58859c into teslamotors:master Aug 15, 2023
1 check passed
@ashi009 ashi009 deleted the ashi009-patch-1 branch August 17, 2023 04:18
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

3 participants