fix(files): add debug logs for checking chunks upon finishing upload session

This commit is contained in:
Karol Sójko 2023-06-09 13:37:25 +02:00
parent c0fa83bce6
commit 5f0929c1aa
No known key found for this signature in database
GPG key ID: 50D9C5A8D4B8D73F

View file

@ -60,7 +60,13 @@ export class FSFileUploader implements FileUploaderInterface {
const orderedKeys = [...fileChunks.keys()].sort((a, b) => a - b)
for (const orderedKey of orderedKeys) {
await promises.appendFile(`${this.fileUploadPath}/${filePath}`, fileChunks.get(orderedKey) as Uint8Array)
const chunk = fileChunks.get(orderedKey)
if (!chunk) {
throw new Error(`Could not find chunk ${orderedKey} for upload ${uploadId}`)
}
this.logger.debug(`FS writing chunk ${orderedKey} for ${uploadId}: ${JSON.stringify(chunk)}`)
await promises.appendFile(`${this.fileUploadPath}/${filePath}`, chunk)
}
this.inMemoryChunks.delete(uploadId)