Skip to content

Commit

Permalink
Merge pull request #919 from dandi/opt01
Browse files Browse the repository at this point in the history
Don't repeat API requests when finding subdir files to delete before Zarr upload
  • Loading branch information
yarikoptic committed Feb 21, 2022
2 parents 5229292 + 23d91df commit e8c71aa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dandi/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,11 +866,15 @@ def iter_upload(
asset_path,
p,
)
for ee in e.iterfiles():
try:
to_delete.append(old_zarr_entries.pop(str(ee)))
except KeyError:
pass
eprefix = str(e) + "/"
sub_e = [
(k, v)
for k, v in old_zarr_entries.items()
if k.startswith(eprefix)
]
for k, v in sub_e:
old_zarr_entries.pop(k)
to_delete.append(v)
to_upload.append(item)
elif pdigest != e.get_digest().value:
lgr.debug(
Expand Down

0 comments on commit e8c71aa

Please sign in to comment.