We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce3e14f commit e17b195Copy full SHA for e17b195
1 file changed
Include/internal/pycore_backoff.h
@@ -65,13 +65,11 @@ static inline _Py_BackoffCounter
65
restart_backoff_counter(_Py_BackoffCounter counter)
66
{
67
assert(!is_unreachable_backoff_counter(counter));
68
- int backoff = counter.value_and_backoff & BACKOFF_MASK;
69
- if (backoff < MAX_BACKOFF) {
70
- return make_backoff_counter((1 << (2 * backoff + 3)) - 1, backoff + 1);
71
- }
72
- else {
73
- return make_backoff_counter((1 << (2 * MAX_BACKOFF + 1)) - 1, MAX_BACKOFF);
74
+ uint16_t backoff = counter.value_and_backoff & BACKOFF_MASK;
+ assert(backoff <= MAX_BACKOFF);
+ backoff = (backoff == MAX_BACKOFF) ? backoff : backoff + 1;
+ uint16_t value = (1 << (2 * backoff + 1)) - 1;
+ return make_backoff_counter(value, backoff);
75
}
76
77
static inline _Py_BackoffCounter
0 commit comments