mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
change upload to paralel
This commit is contained in:
@@ -76,34 +76,34 @@ class UploadFileUseCase {
|
|||||||
if(needUpload) {
|
if(needUpload) {
|
||||||
|
|
||||||
// upload every chunk at onces
|
// upload every chunk at onces
|
||||||
// const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||||
|
|
||||||
// if(uploadRequest.isErr()) {
|
if(uploadRequest.isErr()) {
|
||||||
// connection = false
|
connection = false
|
||||||
// const pingRequest = await this.CMAPIService.ping()
|
const pingRequest = await this.CMAPIService.ping()
|
||||||
// if( pingRequest.isErr()) {
|
if( pingRequest.isErr()) {
|
||||||
// errorMessage = UploadError.noConnection
|
errorMessage = UploadError.noConnection
|
||||||
// } else {
|
} else {
|
||||||
// errorMessage = UploadError.slow
|
errorMessage = UploadError.slow
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// })
|
})
|
||||||
// allRequest.push(request)
|
allRequest.push(request)
|
||||||
|
|
||||||
// one by one chunk upload
|
// one by one chunk upload
|
||||||
const request = readAndUploadChunk(index)
|
// const request = readAndUploadChunk(index)
|
||||||
allRequest.push(request)
|
// allRequest.push(request)
|
||||||
const uploadRequest = await request
|
// const uploadRequest = await request
|
||||||
|
|
||||||
if(uploadRequest.isErr()) {
|
// if(uploadRequest.isErr()) {
|
||||||
const pingRequest = await this.CMAPIService.ping()
|
// const pingRequest = await this.CMAPIService.ping()
|
||||||
if( pingRequest.isErr()) {
|
// if( pingRequest.isErr()) {
|
||||||
return resolve(err(UploadError.noConnection))
|
// return resolve(err(UploadError.noConnection))
|
||||||
} else {
|
// } else {
|
||||||
return resolve(err(UploadError.slow))
|
// return resolve(err(UploadError.slow))
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,14 +269,17 @@ export class PublicationFormMV {
|
|||||||
PublicationAttachmentEntity.chucksManager.setManualRetry()
|
PublicationAttachmentEntity.chucksManager.setManualRetry()
|
||||||
resolve(false)
|
resolve(false)
|
||||||
} else {
|
} else {
|
||||||
const guid = PublicationAttachmentEntity.chucksManager.path
|
|
||||||
this.ObjectMergeNotification.subscribe(guid, (data) => {
|
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
||||||
|
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
||||||
|
|
||||||
|
if(mergeRequest.isOk()) {
|
||||||
PublicationAttachmentEntity.chucksManager.contentSetReady()
|
PublicationAttachmentEntity.chucksManager.contentSetReady()
|
||||||
resolve(true)
|
resolve(true)
|
||||||
})
|
} else {
|
||||||
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
resolve(false)
|
||||||
this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
}
|
||||||
resolve(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user