Skip to content

Commit f2e01bd

Browse files
committed
Resumable uploads and downloads working
1 parent 9af5bc6 commit f2e01bd

File tree

2 files changed

+180
-155
lines changed

2 files changed

+180
-155
lines changed

lib/transfer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,13 @@ async def collect_upload(self, stream: AsyncIterator[bytes], resume_from: int =
263263

264264
await self.store.set_sender_state(ClientState.ACTIVE)
265265

266-
# Store chunk and update progress
267266
last_chunk_id = await self.store.put_chunk(chunk)
268267
bytes_uploaded += len(chunk)
269268
chunk_count += 1
270269

271-
# Save progress more frequently for better resumption
272-
# Save every 4KB (every chunk in most tests) or every 16KB whichever comes first
273270
if chunk_count % 1 == 0 or bytes_uploaded % (16 * 1024) == 0:
274271
await self.store.save_upload_progress(bytes_uploaded=bytes_uploaded, last_chunk_id=last_chunk_id)
275-
self.debug(f"△ Progress saved: {bytes_uploaded} bytes, chunk {last_chunk_id}")
276272

277-
# Final progress save and completion handling
278273
await self.store.save_upload_progress(bytes_uploaded=bytes_uploaded, last_chunk_id=last_chunk_id)
279274

280275
if bytes_uploaded >= self.file.size:

0 commit comments

Comments
 (0)