Skip to content

Commit 6277f78

Browse files
committed
Address review comments
1 parent 039b2a4 commit 6277f78

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dandi/download.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,13 @@ def feed(self, path: str, status: dict) -> Iterator[dict]:
12481248
if status.get("status") == "skipped":
12491249
self.files_fed += 1
12501250
self.file_states[DLState.SKIPPED] += 1
1251-
try:
1251+
if path in self.downloading:
1252+
lgr.debug(
1253+
"We were downloading %s, which we just skipped -- must not happen",
1254+
path,
1255+
)
1256+
# To avoid double-accounting etc.
12521257
self.total_downloaded -= self.downloading.pop(path).downloaded
1253-
except KeyError:
1254-
pass
12551258
# Treat skipped as "downloaded" for the matter of accounting
12561259
if size is not None:
12571260
self.total_downloaded += size
@@ -1261,6 +1264,7 @@ def feed(self, path: str, status: dict) -> Iterator[dict]:
12611264
self.files_fed += 1
12621265
self.file_states[DLState.STARTING] += 1
12631266
assert size is not None
1267+
assert path not in self.downloading
12641268
self.downloading[path] = DownloadProgress(size=size)
12651269
self.maxsize += size
12661270
if self.file_states[DLState.DOWNLOADING]:

0 commit comments

Comments
 (0)