|
@@ -134,13 +134,32 @@ class AzureFileUploader extends AbstractFileUploader {
|
|
|
const blockBlobClient: BlockBlobClient = containerClient.getBlockBlobClient(filePath);
|
|
const blockBlobClient: BlockBlobClient = containerClient.getBlockBlobClient(filePath);
|
|
|
const contentHeaders = createContentHeaders(attachment);
|
|
const contentHeaders = createContentHeaders(attachment);
|
|
|
|
|
|
|
|
- await blockBlobClient.uploadStream(readable, undefined, undefined, {
|
|
|
|
|
- blobHTTPHeaders: {
|
|
|
|
|
- // put type and the file name for reference information when uploading
|
|
|
|
|
- blobContentType: getContentHeaderValue(contentHeaders, 'Content-Type'),
|
|
|
|
|
- blobContentDisposition: getContentHeaderValue(contentHeaders, 'Content-Disposition'),
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ const uploadTimeout = configManager.getConfig('app:fileUploadTimeout');
|
|
|
|
|
+
|
|
|
|
|
+ await blockBlobClient.uploadStream(readable, undefined, undefined, {
|
|
|
|
|
+ blobHTTPHeaders: {
|
|
|
|
|
+ // put type and the file name for reference information when uploading
|
|
|
|
|
+ blobContentType: getContentHeaderValue(contentHeaders, 'Content-Type'),
|
|
|
|
|
+ blobContentDisposition: getContentHeaderValue(contentHeaders, 'Content-Disposition'),
|
|
|
|
|
+ },
|
|
|
|
|
+ abortSignal: AbortSignal.timeout(uploadTimeout),
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ logger.debug(`File upload completed successfully: fileName=${attachment.fileName}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (error) {
|
|
|
|
|
+ // Handle timeout error specifically
|
|
|
|
|
+ if (error.name === 'AbortError') {
|
|
|
|
|
+ logger.warn(`Upload timeout: fileName=${attachment.fileName}`, error);
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ logger.error(`File upload failed: fileName=${attachment.fileName}`, error);
|
|
|
|
|
+ }
|
|
|
|
|
+ // Re-throw the error to be handled by the caller.
|
|
|
|
|
+ // The pipeline automatically handles stream cleanup on error.
|
|
|
|
|
+ throw error;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|