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

fix: avoid race conditions #89

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Conversation

aykevl
Copy link
Contributor

@aykevl aykevl commented Sep 10, 2024

These race conditions may seem harmless, and maybe they are unlikely to cause real trouble, but:

  1. There is a theoretical chance they do. A partially written time value in one goroutine may result in an invalid (and very wrong) time in another, leading to misbehaving code.
  2. They introduce noise, and make it more difficult to find&fix other race conditions.

These race conditions may seem harmless, and maybe they are unlikely to
cause real trouble, but:

 1. There is a theoretical chance they do. A partially written time
    value in one goroutine may result in an invalid (and very wrong)
    time in another, leading to misbehaving code.
 2. They introduce noise, and make it more difficult to find&fix other
    race conditions.
@devgianlu
Copy link
Owner

Makes sense. While very unlikely, another race happened with #79 so it's worth fixing them.

@devgianlu devgianlu merged commit 9dcbd18 into devgianlu:master Sep 10, 2024
1 check passed
@aykevl aykevl deleted the fix-ping-races branch September 10, 2024 10:23
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.

2 participants