dolphindb 3.1.24 → 3.1.27
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/browser.d.ts +0 -1
- package/browser.js +1 -31
- package/browser.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +2 -31
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -417,7 +417,6 @@ export declare class DDB {
|
|
|
417
417
|
print_object_buffer: boolean;
|
|
418
418
|
print_message: boolean;
|
|
419
419
|
parse_object: boolean;
|
|
420
|
-
heartbeat_aborter?: AbortController;
|
|
421
420
|
/** 在 websocket 收到的第一个 error 时,
|
|
422
421
|
在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
|
|
423
422
|
这个 error 的错误信息最准确 */
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { concat, assert, inspect, typed_array_to_buffer, connect_websocket, Lock, genid, seq, zip_object, WebSocketOpen, WebSocketClosed, WebSocketClosing, decode,
|
|
1
|
+
import { concat, assert, inspect, typed_array_to_buffer, connect_websocket, Lock, genid, seq, zip_object, WebSocketOpen, WebSocketClosed, WebSocketClosing, decode, check, empty, colored } from 'xshell';
|
|
2
2
|
import { t } from "./i18n/index.js";
|
|
3
3
|
import { ddb_tensor_bytes, DdbChartType, DdbDurationUnit, DdbForm, generate_array_type, DdbFunctionType, DdbType, DdbVoidType, dictables, function_definition_patterns, get_big_int_128, get_time_ddbobj, get_duration_unit, get_type_name, int1282str, ipaddr2str, is_decimal_null_value, is_decimal_type, time_formatters, number_nulls, nulls, set_big_int_128, uuid2str, get_times_ddbobj, funcdefs, get_number_formatter } from "./common.js";
|
|
4
4
|
export * from "./common.js";
|
|
@@ -2410,7 +2410,6 @@ export class DDB {
|
|
|
2410
2410
|
print_object_buffer = false;
|
|
2411
2411
|
print_message = true;
|
|
2412
2412
|
parse_object = true;
|
|
2413
|
-
heartbeat_aborter;
|
|
2414
2413
|
/** 在 websocket 收到的第一个 error 时,
|
|
2415
2414
|
在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
|
|
2416
2415
|
这个 error 的错误信息最准确 */
|
|
@@ -2522,16 +2521,13 @@ export class DDB {
|
|
|
2522
2521
|
this.lwebsocket.resource = await connect_websocket(url, {
|
|
2523
2522
|
protocols: this.streaming ? ['streaming'] : this.dolphindb ? undefined : [this.language],
|
|
2524
2523
|
proxy: this.proxy,
|
|
2524
|
+
keep_alive_duration: 30_000,
|
|
2525
2525
|
on_message: (buffer, websocket) => {
|
|
2526
2526
|
this.on_message(new Uint8Array(buffer), websocket);
|
|
2527
2527
|
},
|
|
2528
2528
|
on_error: error => {
|
|
2529
2529
|
this.error ??= new DdbConnectionError(this.url, error);
|
|
2530
|
-
this.heartbeat_aborter?.abort();
|
|
2531
2530
|
this.on_error();
|
|
2532
|
-
},
|
|
2533
|
-
on_close: () => {
|
|
2534
|
-
this.heartbeat_aborter?.abort();
|
|
2535
2531
|
}
|
|
2536
2532
|
});
|
|
2537
2533
|
}
|
|
@@ -2545,30 +2541,6 @@ export class DDB {
|
|
|
2545
2541
|
await this.rpc('connect', { skip_connection_check: true });
|
|
2546
2542
|
if (this.streaming)
|
|
2547
2543
|
await this.subscribe();
|
|
2548
|
-
else
|
|
2549
|
-
// 定时执行一次空脚本作为心跳检查,避免因为 nat 超时导致 tcp 连接断开
|
|
2550
|
-
(async () => {
|
|
2551
|
-
this.heartbeat_aborter = new AbortController();
|
|
2552
|
-
while (true) {
|
|
2553
|
-
// 连接主动关闭时从循环退出防止影响 node.js 退出
|
|
2554
|
-
try {
|
|
2555
|
-
await delay(1000 * 60 * 4.5, { signal: this.heartbeat_aborter.signal });
|
|
2556
|
-
}
|
|
2557
|
-
catch {
|
|
2558
|
-
break;
|
|
2559
|
-
}
|
|
2560
|
-
if (this.connected)
|
|
2561
|
-
try {
|
|
2562
|
-
await this.eval('');
|
|
2563
|
-
}
|
|
2564
|
-
catch (error) {
|
|
2565
|
-
console.log(t('{{time}} 心跳检测失败,连接已断开', { time: new Date().to_formal_str() }), error);
|
|
2566
|
-
break;
|
|
2567
|
-
}
|
|
2568
|
-
else
|
|
2569
|
-
break;
|
|
2570
|
-
}
|
|
2571
|
-
})();
|
|
2572
2544
|
resolve();
|
|
2573
2545
|
}
|
|
2574
2546
|
catch (error) {
|
|
@@ -2614,7 +2586,6 @@ export class DDB {
|
|
|
2614
2586
|
return options.join('_');
|
|
2615
2587
|
}
|
|
2616
2588
|
disconnect() {
|
|
2617
|
-
this.heartbeat_aborter?.abort();
|
|
2618
2589
|
const { resource } = this.lwebsocket;
|
|
2619
2590
|
if (resource) {
|
|
2620
2591
|
const { readyState } = resource;
|