dolphindb 2.0.955 → 2.0.957

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2320,6 +2320,7 @@ class DDB {
2320
2320
  resolve();
2321
2321
  }
2322
2322
  catch (error) {
2323
+ this.error ??= error;
2323
2324
  reject(error);
2324
2325
  }
2325
2326
  });
@@ -2356,9 +2357,13 @@ class DDB {
2356
2357
  return options.join('_');
2357
2358
  }
2358
2359
  disconnect() {
2359
- if (this.connected)
2360
- // 这里不获取 lock,直接关闭连接
2361
- this.lwebsocket.resource.close(1000);
2360
+ const { resource } = this.lwebsocket;
2361
+ if (resource) {
2362
+ const { readyState } = resource;
2363
+ if (readyState !== WebSocket.CLOSED && readyState !== WebSocket.CLOSING)
2364
+ // 这里不获取 lock,直接关闭连接
2365
+ resource.close(1000);
2366
+ }
2362
2367
  }
2363
2368
  /** (内部使用的方法) rpc through websocket (function/script/variable command)
2364
2369
  未连接到 DDB 时调用会自动连接,连接断开时调用会抛出 DdbConnectionError