This commit is contained in:
2023-05-01 19:32:23 -04:00
parent a5b041ae9a
commit 704942fd3a
3 changed files with 67 additions and 3 deletions

View File

@@ -284,7 +284,7 @@ export function Client(cid, secret) {
this.secret = secret;
this.cid = cid;
this.status = reactive({ connected: true });
this.status = reactive({ connected: true, busy: 0 });
this.close = function() {
console.log('CLOSE', cid);
@@ -298,7 +298,12 @@ export function Client(cid, secret) {
if(body.params) Array.prototype.push.apply(body.params, params);
else body.params = params;
}
var res = await vista.call(cid, body);
this.status.busy++;
try {
var res = await vista.call(cid, body);
} finally {
this.status.busy--;
}
if((res.error) && (res.error.type == 'ConnectionResetError')) this.close();
res._request = body;
return res;