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

Make rawQuery timeout handling more thread-safe #42

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

ugexe
Copy link
Contributor

@ugexe ugexe commented May 12, 2024

Previously an elapsed duration was saved on the Client object and was updated multiple times on each call to rawQuery. This could lead to a race condition when calling whois.Whois(...) in parallel, where one thread halfway through the function has a non-zero elapsed duration and another thread entering the function sets it to 0. This removes the elapsed field on the Client object and uses a local variable instead, which avoids the aforementioned issue.

Previous an `elapsed` duration was saved on the `Client` object and was updated multiple times on each call to `rawQuery`. This could lead to a race condition when calling `whois.Whois(...)` in parallel, where one thread halfway through the function has a non-zero elapsed duration and another thread entering the function sets it to 0. This removes the `elapsed` field on the `Client` object and uses a local variable instead, which avoids the aforementioned issue.
@likexian
Copy link
Owner

likexian commented Sep 2, 2024

Hello @ugexe
Thanks for your works!


If you think this repository is helpful, please share it with friends, thanks.

@likexian likexian merged commit c01ca63 into likexian:master Sep 2, 2024
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