mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix
This commit is contained in:
@@ -147,21 +147,29 @@ class ReconnectingWebSocketSignalR {
|
||||
}
|
||||
|
||||
commit(path): Promise<Result<true, false>> {
|
||||
console.log('committing')
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
console.log('this.connection.invoke', this.connection)
|
||||
this.connection.invoke("CommitUpload", path).then((e) => {
|
||||
console.log("commit message", e)
|
||||
resolve(ok(true))
|
||||
}).catch(err => {
|
||||
console.error('upload catch commit error')
|
||||
if(this.isOpen) {
|
||||
try {
|
||||
console.log('this.connection.invoke', this.connection)
|
||||
this.connection.invoke("CommitUpload", path).then((e) => {
|
||||
console.log("commit message", e)
|
||||
resolve(ok(true))
|
||||
}).catch(err => {
|
||||
console.error('upload catch commit error')
|
||||
resolve(Err(false))
|
||||
console.error(err.toString())
|
||||
});
|
||||
} catch(error) {
|
||||
resolve(Err(false))
|
||||
console.error(err.toString())
|
||||
});
|
||||
} catch(error) {
|
||||
resolve(Err(false))
|
||||
console.error('upload commit error')
|
||||
console.error(error)
|
||||
console.error('upload commit error')
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.onConnect.push(()=> {
|
||||
resolve(this.commit(path))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -410,61 +418,60 @@ export class ObjectMergeNotification{
|
||||
this.runWatch = false
|
||||
})
|
||||
|
||||
this.socket.subscribe((data: socketResponse) => {
|
||||
if(data.IsCompleted == true) {
|
||||
console.log("==================!!!====================")
|
||||
try {
|
||||
this.callbacks[data.Guid](data)
|
||||
delete this.callbacks[data.Guid]
|
||||
} catch (error) {}
|
||||
} else {
|
||||
console.log("else", data)
|
||||
}
|
||||
})
|
||||
// this.socket.subscribe((data: socketResponse) => {
|
||||
// if(data.IsCompleted == true) {
|
||||
// console.log("==================!!!====================")
|
||||
// try {
|
||||
// this.callbacks[data.Guid](data)
|
||||
// delete this.callbacks[data.Guid]
|
||||
// } catch (error) {}
|
||||
// } else {
|
||||
// console.log("else", data)
|
||||
// }
|
||||
// })
|
||||
|
||||
// this.socket.connect();
|
||||
// this.watch()
|
||||
}
|
||||
|
||||
connect() {
|
||||
// this.socket.connect();
|
||||
this.socket.connect();
|
||||
}
|
||||
|
||||
close() {
|
||||
// this.socket.disconnect();
|
||||
// this.watchCount = 0;
|
||||
// this.runWatch = false
|
||||
this.socket.disconnect();
|
||||
this.watchCount = 0;
|
||||
this.runWatch = false
|
||||
}
|
||||
|
||||
async watch() {
|
||||
|
||||
// this.watchCount = 0;
|
||||
this.watchCount = 0;
|
||||
|
||||
// if(this.runWatch) {
|
||||
// setTimeout(async () => {
|
||||
// for(const [key, funx] of Object.entries(this.callbacks)) {
|
||||
if(this.runWatch) {
|
||||
setTimeout(async () => {
|
||||
for(const [key, funx] of Object.entries(this.callbacks)) {
|
||||
|
||||
// const request = await this.CMAPIService.getVideoHeader(key)
|
||||
const request = await this.CMAPIService.getVideoHeader(key)
|
||||
|
||||
// if(request.isOk()) {
|
||||
// funx()
|
||||
// delete this.callbacks[key]
|
||||
// }
|
||||
// }
|
||||
if(request.isOk()) {
|
||||
funx()
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
}
|
||||
|
||||
// this.watchCount++
|
||||
// if(this.watchCount <= 15) {
|
||||
// this.watch()
|
||||
// } else {
|
||||
// this.runWatch = false
|
||||
// }
|
||||
this.watchCount++
|
||||
if(this.watchCount <= 15) {
|
||||
this.watch()
|
||||
} else {
|
||||
this.runWatch = false
|
||||
}
|
||||
|
||||
// }, 1000)
|
||||
}, 1000)
|
||||
|
||||
|
||||
// } else {
|
||||
// console.log("end loop============================")
|
||||
// }
|
||||
} else {
|
||||
console.log("end loop============================")
|
||||
}
|
||||
}
|
||||
|
||||
subscribe(GUID, callback:Function) {
|
||||
|
||||
Reference in New Issue
Block a user