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/browser.d.ts
CHANGED
|
@@ -425,7 +425,6 @@ export declare class DDB {
|
|
|
425
425
|
print_object_buffer: boolean;
|
|
426
426
|
print_message: boolean;
|
|
427
427
|
parse_object: boolean;
|
|
428
|
-
heartbeat_aborter?: AbortController;
|
|
429
428
|
/** 在 websocket 收到的第一个 error 时,
|
|
430
429
|
在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
|
|
431
430
|
这个 error 的错误信息最准确 */
|
package/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { empty } from 'xshell/prototype.browser.js';
|
|
2
2
|
import { blue, cyan, green, grey, magenta } from 'xshell/chalk.browser.js';
|
|
3
|
-
import { concat, assert, Lock, genid, seq, zip_object, decode,
|
|
3
|
+
import { concat, assert, Lock, genid, seq, zip_object, decode, check } from 'xshell/utils.browser.js';
|
|
4
4
|
import { connect_websocket } from 'xshell/net.browser.js';
|
|
5
5
|
import { t } from "./i18n/index.js";
|
|
6
6
|
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";
|
|
@@ -2447,7 +2447,6 @@ export class DDB {
|
|
|
2447
2447
|
print_object_buffer = false;
|
|
2448
2448
|
print_message = true;
|
|
2449
2449
|
parse_object = true;
|
|
2450
|
-
heartbeat_aborter;
|
|
2451
2450
|
/** 在 websocket 收到的第一个 error 时,
|
|
2452
2451
|
在 connect_websocket 的 on_error 回调中构造 DdbConnectionError 并保存到 DDB 对象上,
|
|
2453
2452
|
这个 error 的错误信息最准确 */
|
|
@@ -2562,11 +2561,7 @@ export class DDB {
|
|
|
2562
2561
|
},
|
|
2563
2562
|
on_error: error => {
|
|
2564
2563
|
this.error ??= new DdbConnectionError(this.url, error);
|
|
2565
|
-
this.heartbeat_aborter?.abort();
|
|
2566
2564
|
this.on_error();
|
|
2567
|
-
},
|
|
2568
|
-
on_close: () => {
|
|
2569
|
-
this.heartbeat_aborter?.abort();
|
|
2570
2565
|
}
|
|
2571
2566
|
});
|
|
2572
2567
|
}
|
|
@@ -2580,30 +2575,6 @@ export class DDB {
|
|
|
2580
2575
|
await this.rpc('connect', { skip_connection_check: true });
|
|
2581
2576
|
if (this.streaming)
|
|
2582
2577
|
await this.subscribe();
|
|
2583
|
-
else
|
|
2584
|
-
// 定时执行一次空脚本作为心跳检查,避免因为 nat 超时导致 tcp 连接断开
|
|
2585
|
-
(async () => {
|
|
2586
|
-
this.heartbeat_aborter = new AbortController();
|
|
2587
|
-
while (true) {
|
|
2588
|
-
// 连接主动关闭时从循环退出防止影响 node.js 退出
|
|
2589
|
-
try {
|
|
2590
|
-
await delay(1000 * 60 * 4.5, { signal: this.heartbeat_aborter.signal });
|
|
2591
|
-
}
|
|
2592
|
-
catch {
|
|
2593
|
-
break;
|
|
2594
|
-
}
|
|
2595
|
-
if (this.connected)
|
|
2596
|
-
try {
|
|
2597
|
-
await this.eval('');
|
|
2598
|
-
}
|
|
2599
|
-
catch (error) {
|
|
2600
|
-
console.log(t('{{time}} 心跳检测失败,连接已断开', { time: new Date().to_formal_str() }), error);
|
|
2601
|
-
break;
|
|
2602
|
-
}
|
|
2603
|
-
else
|
|
2604
|
-
break;
|
|
2605
|
-
}
|
|
2606
|
-
})();
|
|
2607
2578
|
resolve();
|
|
2608
2579
|
}
|
|
2609
2580
|
catch (error) {
|
|
@@ -2649,7 +2620,6 @@ export class DDB {
|
|
|
2649
2620
|
return options.join('_');
|
|
2650
2621
|
}
|
|
2651
2622
|
disconnect() {
|
|
2652
|
-
this.heartbeat_aborter?.abort();
|
|
2653
2623
|
const { resource } = this.lwebsocket;
|
|
2654
2624
|
if (resource) {
|
|
2655
2625
|
const { readyState } = resource;
|