@@ -26,6 +26,8 @@ export class DirectUploadClient implements IDirectUploadClient {
2626 private readonly progressAfterUrlGeneration : number = 10
2727 private readonly progressAfterFileUpload : number = 100
2828
29+ private readonly fileUploadTimeoutMs : number = 60_000
30+
2931 constructor ( filesRepository : IFilesRepository , maxMultipartRetries = 5 ) {
3032 this . filesRepository = filesRepository
3133 this . maxMultipartRetries = maxMultipartRetries
@@ -38,7 +40,7 @@ export class DirectUploadClient implements IDirectUploadClient {
3840 abortController : AbortController ,
3941 destination ?: FileUploadDestination
4042 ) : Promise < string > {
41- if ( destination == undefined ) {
43+ if ( destination === undefined ) {
4244 destination = await this . filesRepository
4345 . getFileUploadDestination ( datasetId , file )
4446 . catch ( ( error ) => {
@@ -71,7 +73,7 @@ export class DirectUploadClient implements IDirectUploadClient {
7173 'Content-Length' : file . size . toString ( ) ,
7274 'x-amz-tagging' : 'dv-state=temp'
7375 } ,
74- timeout : 60000 ,
76+ timeout : this . fileUploadTimeoutMs ,
7577 signal : abortController . signal
7678 } )
7779 } catch ( error ) {
@@ -113,12 +115,12 @@ export class DirectUploadClient implements IDirectUploadClient {
113115 } ,
114116 maxBodyLength : Infinity ,
115117 maxContentLength : Infinity ,
116- timeout : 60000 ,
118+ timeout : this . fileUploadTimeoutMs ,
117119 signal : abortController . signal
118120 } )
119121 const eTag = response . headers [ 'etag' ] . replace ( / " / g, '' )
120122 eTags [ `${ index + 1 } ` ] = eTag
121- progress ( this . progressAfterUrlGeneration + progressPartSize * ( index + 1 ) )
123+ progress ( Math . round ( this . progressAfterUrlGeneration + progressPartSize * ( index + 1 ) ) )
122124 } catch ( error ) {
123125 if ( axios . isCancel ( error ) ) {
124126 await this . abortMultipartUpload ( file . name , datasetId , destination . abortEndpoint )
0 commit comments