Skip to content

Conversation

ptiurin
Copy link
Contributor

@ptiurin ptiurin commented Nov 23, 2022

Asyncio prevents us from sharing Connection objects across threads due to registering httpx Client to the main thread's loop. Trio seems to solve this problem, as confirmed in the integration test I've added. Looks like there's no impact on the rest of the functionality.

@ptiurin ptiurin marked this pull request as ready for review November 23, 2022 18:27
Copy link
Collaborator

@stepansergeevitch stepansergeevitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and much simpler. Can you please also try to run async queries in jupyter, I believe it was flaky as some point

async_job_thread = AsyncJobThread()
return async_job_thread.execute(f(*args, **kwargs))
return loop.run_until_complete(f(*args, **kwargs))
return trio.run(partial(f, *args, **kwargs))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@ptiurin
Copy link
Contributor Author

ptiurin commented Nov 24, 2022

Can you please also try to run async queries in jupyter, I believe it was flaky as some point

Jupyter seems to be working fine as well.

@ptiurin ptiurin changed the title fix: use trio for async_to_sync feat: use trio for async_to_sync Nov 24, 2022
@ptiurin ptiurin merged commit 422a26f into main Nov 24, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@ptiurin ptiurin deleted the fix-multithreading branch November 24, 2022 15:00
@ptiurin ptiurin restored the fix-multithreading branch November 24, 2022 15:02
@ptiurin ptiurin deleted the fix-multithreading branch March 14, 2023 08:46
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