Skip to content

Commit

Permalink
Avoid race condition between status monitoring and download tasks (#532)
Browse files Browse the repository at this point in the history
Add condition to exit polling loop; update tests
  • Loading branch information
ponyisi authored Dec 6, 2024
1 parent 2e2af1b commit b969ab3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion servicex/query_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ async def get_signed_url(
# signing urls for a previous transform then we know it is complete as well
if cached_record or (
self.current_status
and self.current_status.status in DONE_STATUS
and (self.current_status.status in DONE_STATUS
and self.current_status.files_completed == len(files_seen))
):
break

Expand Down
4 changes: 2 additions & 2 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def test_download_files(python_dataset):
progress_mock = Mock()
python_dataset.minio_polling_interval = 0
python_dataset.minio = minio_mock
python_dataset.current_status = Mock(status="Complete")
python_dataset.current_status = Mock(status="Complete", files_completed=2)
python_dataset.configuration.shortened_downloaded_filename = False

result_uris = await python_dataset.download_files(
Expand All @@ -142,7 +142,7 @@ async def test_download_files_with_signed_urls(python_dataset):

python_dataset.minio_polling_interval = 0
python_dataset.minio = minio_mock
python_dataset.current_status = Mock(status="Complete")
python_dataset.current_status = Mock(status="Complete", files_completed=2)
python_dataset.configuration.shortened_downloaded_filename = False

result_uris = await python_dataset.download_files(
Expand Down

0 comments on commit b969ab3

Please sign in to comment.