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

asyncio for make-stats #97

Merged
merged 7 commits into from
Jun 20, 2023
Merged

asyncio for make-stats #97

merged 7 commits into from
Jun 20, 2023

Conversation

mhauru
Copy link
Collaborator

@mhauru mhauru commented Jun 6, 2023

Runs the make-stats queries in parallel.

@mhauru mhauru requested review from Iain-S and myyong June 6, 2023 15:47
@@ -167,7 +168,9 @@ def make_stats(
typer.echo("Missing source database connection details.", err=True)
sys.exit(1)

src_stats = make_src_stats(src_dsn, config)
src_stats = asyncio.get_event_loop().run_until_complete(
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this change was purely for SSG then it sounds like .run() would be simplest but I guess we're calling make_stats from TAPAS so there might already be a loop running?

Suggested change
src_stats = asyncio.get_event_loop().run_until_complete(
src_stats = asyncio.get_event_loop().run_until_complete(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeaaah, I think that was my logic here. I'm not super sure of my understanding of how things like multiple event loops work though.

@mhauru mhauru requested a review from Iain-S June 19, 2023 16:46
Copy link
Collaborator

@Iain-S Iain-S left a comment

Choose a reason for hiding this comment

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

LGTM

@mhauru mhauru merged commit 0717483 into main Jun 20, 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