Skip to content

refactor: simplify exponential backoff and refactor env - #1185

Merged
dunglas merged 12 commits into
mainfrom
refactor/workers2
Nov 23, 2024
Merged

refactor: simplify exponential backoff and refactor env#1185
dunglas merged 12 commits into
mainfrom
refactor/workers2

Conversation

@withinboredom

Copy link
Copy Markdown
Member

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

@dunglasdunglas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good refactoring!

Comment threadbackoff.go Outdated
Comment threadbackoff.go Outdated
Comment threadbackoff.go Outdated
Comment threadbackoff.go
Comment threadbackoff_test.go Outdated
Comment threadbackoff_test.go Outdated
Comment threadenv.go Outdated
Comment threadenv.go Outdated
withinboredomand others added 6 commits November 21, 2024 23:24
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
@AlliBalliBaba

Copy link
Copy Markdown
Contributor

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

@dunglasdunglas changed the title Simplify exponential backoff and refactor envrefactor: simplify exponential backoff and refactor envNov 23, 2024
@dunglas
dunglas merged commit 1e279bc into mainNov 23, 2024
@dunglas
dunglas deleted the refactor/workers2 branch November 23, 2024 10:29
Sign up for freeto 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

@withinboredom@AlliBalliBaba@dunglas