Skip to content

Commit a374227

Browse files
Abel Milashclaude
andcommitted
Align async total_chunks calculation with sync (math.ceil)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 55e3359 commit a374227

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/PowerPlatform/Dataverse/aio/data/_async_upload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import annotations
77

88
import asyncio
9+
import math
910
from pathlib import Path
1011
from typing import Optional
1112
from urllib.parse import quote
@@ -172,7 +173,7 @@ async def _upload_file_chunk(
172173
effective_size = recommended_size or (4 * 1024 * 1024)
173174
if effective_size <= 0:
174175
raise ValueError("effective chunk size must be positive")
175-
total_chunks = (total_size + effective_size - 1) // effective_size if total_size else 1
176+
total_chunks = int(math.ceil(total_size / effective_size)) if total_size else 1
176177
uploaded_bytes = 0
177178
with p.open("rb") as fh:
178179
for _ in range(total_chunks):

0 commit comments

Comments
 (0)