mirror of
https://github.com/wisplite/tether-ts.git
synced 2026-05-01 06:22:41 -05:00
clean up promises when client disconnects
This commit is contained in:
Vendored
+7
@@ -29,6 +29,13 @@ export class TetherClient {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
this.websocketHandler.onClose = () => {
|
||||||
|
this.pendingMutations.forEach(pending => {
|
||||||
|
clearTimeout(pending.timeoutId);
|
||||||
|
pending.reject(new Error('Connection closed'));
|
||||||
|
});
|
||||||
|
this.pendingMutations.clear();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
disconnect = () => {
|
disconnect = () => {
|
||||||
this.websocketHandler.close();
|
this.websocketHandler.close();
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ export class TetherClient {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
this.websocketHandler.onClose = () => {
|
||||||
|
this.pendingMutations.forEach(pending => {
|
||||||
|
clearTimeout(pending.timeoutId);
|
||||||
|
pending.reject(new Error('Connection closed'));
|
||||||
|
});
|
||||||
|
this.pendingMutations.clear();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
disconnect = () => {
|
disconnect = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user