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

refactor: simplify exponential backoff and refactor env #1185

Merged
merged 12 commits into from
Nov 23, 2024
Merged

Conversation

withinboredom
Copy link
Collaborator

This steals the movement of the env functions from #1137 and refactors the exponential backoff logic, while greatly simplifying it.

The new exponential backoff api is quite simple:

  • .wait(): pauses execution if there has been a crash
  • .recordSuccess(): resets the backoff state
  • .recordFailure(): increments the pause and returns true if we've crashed too many times

Copy link
Owner

@dunglas dunglas left a comment

Choose a reason for hiding this comment

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

Good refactoring!

backoff.go Outdated Show resolved Hide resolved
backoff.go Outdated Show resolved Hide resolved
backoff.go Outdated Show resolved Hide resolved
backoff.go Show resolved Hide resolved
backoff_test.go Outdated Show resolved Hide resolved
backoff_test.go Outdated Show resolved Hide resolved
env.go Outdated Show resolved Hide resolved
env.go Outdated Show resolved Hide resolved
@AlliBalliBaba
Copy link
Collaborator

As a sidenote, the segfault in the 8.3 tests also randomly happens on main, see #1141

@dunglas dunglas changed the title Simplify exponential backoff and refactor env refactor: simplify exponential backoff and refactor env Nov 23, 2024
@dunglas dunglas merged commit 1e279bc into main Nov 23, 2024
46 checks passed
@dunglas dunglas deleted the refactor/workers2 branch November 23, 2024 10:29
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.

3 participants