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

Use threads to speed up connectivity check #576

Merged

Conversation

orende
Copy link
Contributor

@orende orende commented Jul 23, 2023

Description

Adds a ThreadPoolExecutor to the api.can_connect function in order to send the requests to embed.gog.com and auth.gog.com from separate threads. This lowers the worst case execution time from 10 seconds to 5 seconds, which is noticeable on slow connections.

Checklist

  • CHANGELOG.md was updated (format: - Change made (thanks to github_username))

Uses a ThreadPoolExecutor to send the requests to embed.gog.com and auth.gog.com from separate threads. As these threads do I/O-bound work, they will hand the GIL back while waiting for responses, which speeds up the work as opposed to sending the requests and waiting for the responses sequentially.
@sharkwouter
Copy link
Owner

Nice, that makes more of a difference than I was expecting. Thanks!

@sharkwouter sharkwouter merged commit 79b6d72 into sharkwouter:master Jul 28, 2023
2 checks passed
@orende orende deleted the optimize-can-connect-function branch July 28, 2023 08:45
@sharkwouter sharkwouter added this to the 2.0.0 milestone Jul 30, 2023
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