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) {
|
||||
|
||||
// upload every chunk at onces
|
||||
// const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||
const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||
|
||||
// if(uploadRequest.isErr()) {
|
||||
// connection = false
|
||||
// const pingRequest = await this.CMAPIService.ping()
|
||||
// if( pingRequest.isErr()) {
|
||||
// errorMessage = UploadError.noConnection
|
||||
// } else {
|
||||
// errorMessage = UploadError.slow
|
||||
// }
|
||||
// }
|
||||
if(uploadRequest.isErr()) {
|
||||
connection = false
|
||||
const pingRequest = await this.CMAPIService.ping()
|
||||
if( pingRequest.isErr()) {
|
||||
errorMessage = UploadError.noConnection
|
||||
} else {
|
||||
errorMessage = UploadError.slow
|
||||
}
|
||||
}
|
||||
|
||||
// })
|
||||
// allRequest.push(request)
|
||||
})
|
||||
allRequest.push(request)
|
||||
|
||||
// one by one chunk upload
|
||||
const request = readAndUploadChunk(index)
|
||||
allRequest.push(request)
|
||||
const uploadRequest = await request
|
||||
// const request = readAndUploadChunk(index)
|
||||
// allRequest.push(request)
|
||||
// const uploadRequest = await request
|
||||
|
||||
if(uploadRequest.isErr()) {
|
||||
const pingRequest = await this.CMAPIService.ping()
|
||||
if( pingRequest.isErr()) {
|
||||
return resolve(err(UploadError.noConnection))
|
||||
} else {
|
||||
return resolve(err(UploadError.slow))
|
||||
}
|
||||
}
|
||||
// if(uploadRequest.isErr()) {
|
||||
// const pingRequest = await this.CMAPIService.ping()
|
||||
// if( pingRequest.isErr()) {
|
||||
// return resolve(err(UploadError.noConnection))
|
||||
// } else {
|
||||
// return resolve(err(UploadError.slow))
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -269,14 +269,17 @@ export class PublicationFormMV {
|
||||
PublicationAttachmentEntity.chucksManager.setManualRetry()
|
||||
resolve(false)
|
||||
} 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()
|
||||
resolve(true)
|
||||
})
|
||||
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
||||
this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
||||
resolve(true)
|
||||
} else {
|
||||
resolve(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user