Adjust Ws .disconnect() logic to always clear auto-connect (#3749)
This commit is contained in:
@@ -11,6 +11,7 @@ Changes:
|
|||||||
- Contract reads will now expose an additional `gasRequired` (total estimated)
|
- Contract reads will now expose an additional `gasRequired` (total estimated)
|
||||||
- Allow schedule derives to handle scheduler entries that cannot decode
|
- Allow schedule derives to handle scheduler entries that cannot decode
|
||||||
- Add missing historic `Heartbeat: HeartbeatTo244` mapping to Westend
|
- Add missing historic `Heartbeat: HeartbeatTo244` mapping to Westend
|
||||||
|
- Adjust Ws `.disconnect()` logic to always clear auto-connect
|
||||||
- Add `BlockNumberFor` type mapping
|
- Add `BlockNumberFor` type mapping
|
||||||
- Add Westend 9080 upgrade block
|
- Add Westend 9080 upgrade block
|
||||||
- Add `derive.crowdloan.contributions(paraId)`
|
- Add `derive.crowdloan.contributions(paraId)`
|
||||||
|
|||||||
@@ -215,18 +215,18 @@ export class WsProvider implements ProviderInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Manually disconnect from the connection, clearing autoconnect logic
|
* @description Manually disconnect from the connection, clearing auto-connect logic
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/require-await
|
// eslint-disable-next-line @typescript-eslint/require-await
|
||||||
public async disconnect (): Promise<void> {
|
public async disconnect (): Promise<void> {
|
||||||
|
// switch off autoConnect, we are in manual mode now
|
||||||
|
this.#autoConnectMs = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
assert(!isNull(this.#websocket), 'Cannot disconnect on a non-connected websocket');
|
if (this.#websocket) {
|
||||||
|
// 1000 - Normal closure; the connection successfully completed
|
||||||
// switch off autoConnect, we are in manual mode now
|
this.#websocket.close(1000);
|
||||||
this.#autoConnectMs = 0;
|
}
|
||||||
|
|
||||||
// 1000 - Normal closure; the connection successfully completed
|
|
||||||
this.#websocket.close(1000);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
l.error(error);
|
l.error(error);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user