Skip to content

Commit

Permalink
Fix Azure typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jadkik committed Aug 15, 2024
1 parent 9358041 commit e237dd3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rohmu/object_storage/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,16 @@ def _copy_file_from_bucket(
if time.monotonic() - start < timeout:
time.sleep(0.1)
else:
destination_client.abort_copy(copy_props.id, timeout=timeout)
if copy_props.id is None:
# The description of CopyProperties tells us copy_id should not be None unless status is also None
# The type checker cannot know this, but we still log a warning if this ever happens
self.log.warning(
"Pending copy operation from %r to %r was missing a copy_id, will not be aborted after timeout",
source_key,
destination_key,
)
else:
destination_client.abort_copy(copy_props.id, timeout=timeout)
raise StorageError(
f"Copying {repr(source_key)} to {repr(destination_key)} did not complete in {timeout} seconds"
)
Expand Down

0 comments on commit e237dd3

Please sign in to comment.