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 restarting downloads #784

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

gregtatum
Copy link
Member

Download restarts weren't working because the chunk_iter here was being closed, when only the response needed to be closed between restarts. I tested this manually locally.

@gregtatum gregtatum requested a review from eu9ene July 31, 2024 21:14
@@ -299,10 +299,15 @@ def download_chunks(self) -> Generator[bytes, None, None]:
# the retries are done.
logger.error(f"A download error occurred: {error}")

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the codepath that runs when a response times out, or a network connection is lost.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if "with" can be applied here to ensure the resources will be closed in any case

Copy link
Member Author

Choose a reason for hiding this comment

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

I have been playing around with @contextmanager(I think you pointed that out) and ExitStack. This could would probably be simpler with that.

@gregtatum gregtatum merged commit f0c00e2 into mozilla:main Aug 1, 2024
6 checks passed
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