-
Notifications
You must be signed in to change notification settings - Fork 95
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
tests: executionclient fix & simplify #1781
base: stage
Are you sure you want to change the base?
tests: executionclient fix & simplify #1781
Conversation
Unfollowed: | ||
Wait1: | ||
for { | ||
select { | ||
case <-ctx.Done(): | ||
require.Equal(t, int64(blocksWithLogsLength-followDistance), streamedLogsCount.Load()) | ||
require.Failf(t, "timed out", "err: %v, streamedLogsCount: %d", ctx.Err(), streamedLogsCount.Load()) | ||
case <-time.After(time.Millisecond * 5): | ||
if streamedLogsCount.Load() == int64(blocksWithLogsLength-followDistance) { | ||
break Unfollowed | ||
break Wait1 | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, (on stage
version) if we drop into case <-ctx.Done()
branch here this for
loop will very likely spin perpetually (allocating new Timer
on every iteration through time.After
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, approving but we need to make sure CI passes
Unfollowed: | ||
Wait1: | ||
for { | ||
select { | ||
case <-ctx.Done(): | ||
require.Equal(t, int64(blocksWithLogsLength-followDistance), streamedLogsCount.Load()) | ||
require.Failf(t, "timed out", "err: %v, streamedLogsCount: %d", ctx.Err(), streamedLogsCount.Load()) | ||
case <-time.After(time.Millisecond * 5): | ||
if streamedLogsCount.Load() == int64(blocksWithLogsLength-followDistance) { | ||
break Unfollowed | ||
break Wait1 | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm :)
This PR resolves potential memory leak (similar to what's described in #1780), also simplifying the test affected.