Skip to content

Commit 103832f

Browse files
committed
fix: cache service v1 upload chunk index calculation
1 parent c6ed170 commit 103832f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

routes/_apis/artifactcache/caches/[cacheId].patch.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ export default defineEventHandler(async (event) => {
3737
throw createError({ statusCode: 400, statusMessage: 'Invalid content-range header' })
3838
}
3939

40+
// TODO find a better way to calculate chunk size
4041
// this should be the correct chunk size except for the last chunk
41-
const chunkSize = Math.floor(start / (end - start))
4242
// this should handle the incorrect chunk size of the last chunk by just setting it to the limit of 10000 (for s3)
43-
// TODO find a better way to calculate chunk size
44-
const chunkIndex = Math.min(chunkSize, 10_000)
43+
const chunkIndex = Math.min(Math.floor(start / (end - start)), 9999)
4544

4645
const adapter = await useStorageAdapter()
4746
await adapter.uploadChunk({

0 commit comments

Comments
 (0)