Skip to content

Handle some race conditions in downloading data - #333

Merged
grantroch merged 2 commits into
SeequentEvo:mainfrom
grantroch:fix-some-download-race-conditions
Aug 20, 2026
Merged

Handle some race conditions in downloading data#333
grantroch merged 2 commits into
SeequentEvo:mainfrom
grantroch:fix-some-download-race-conditions

Conversation

@grantroch

Copy link
Copy Markdown
Contributor

Description

This PR attempts to fix a couple race conditions that can happen when downloading data.

  1. In download_file it can be the case that two different processes download the same file at the same time. They will both download different temporary files, but if one finishes downloading and renames before the other one, the second process will throw a PermissionError. If the file exists, the PermissionError is ignored and the destination path points to a valid file.
  2. A lock was added to prevent concurrent coroutines in the same process from duplicating a download. This is rarer as the user isn't likely to be downloading the same exact file from two coroutines. Subsequent callers will wait and use the cached result.

Checklist

  • I have read the contributing guide and the code of conduct

@grantroch
grantroch requested a review from a team as a code owner August 18, 2026 23:20
@CLAassistant

CLAassistant commented Aug 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@GriffinBaxterSeequent GriffinBaxterSeequent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice one! Do note that you'll want to bump the version for evo-sdk-common

@AdamFreemanSeequent
AdamFreemanSeequent self-requested a review August 19, 2026 01:36
@grantroch
grantroch merged commit 6529e08 into SeequentEvo:main Aug 20, 2026
88 checks passed
@grantroch
grantroch deleted the fix-some-download-race-conditions branch August 20, 2026 02:28
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.

4 participants