sqlite-executor 4.0.6 → 4.0.7
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/dist/cjs/core/inflightTracker.d.cts +33 -0
- package/dist/cjs/core/metrics.d.cts +4 -4
- package/dist/cjs/core/pipelineUtils.d.cts +196 -0
- package/dist/cjs/index.cjs +903 -620
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/core/inflightTracker.d.mts +33 -0
- package/dist/esm/core/metrics.d.mts +4 -4
- package/dist/esm/core/pipelineUtils.d.mts +196 -0
- package/dist/esm/index.mjs +903 -620
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +31 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
2
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
@@ -213,7 +213,8 @@ function createRowStreamParser(onRow) {
|
|
|
213
213
|
}
|
|
214
214
|
index = consumed;
|
|
215
215
|
if (consumed > 65536) {
|
|
216
|
-
|
|
216
|
+
buffer = buffer.slice(consumed);
|
|
217
|
+
this.buffer = buffer;
|
|
217
218
|
this._consumed = 0;
|
|
218
219
|
index = 0;
|
|
219
220
|
consumed = 0;
|
|
@@ -264,6 +265,7 @@ function createRowStreamParser(onRow) {
|
|
|
264
265
|
var TOKEN_COLUMN = "__sqlite_executor_token__";
|
|
265
266
|
var DEFAULT_BATCH_SIZE = 10;
|
|
266
267
|
var DEFAULT_MAX_INFLIGHT = 50;
|
|
268
|
+
var INFLIGHT_COMPACT_THRESHOLD = 128;
|
|
267
269
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
268
270
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
269
271
|
}
|
|
@@ -337,7 +339,7 @@ function _type_of(obj) {
|
|
|
337
339
|
}
|
|
338
340
|
var _computedKey;
|
|
339
341
|
function setupStreamParser(task) {
|
|
340
|
-
var
|
|
342
|
+
var pipelineOrFeed = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
|
|
341
343
|
feed: function() {}
|
|
342
344
|
};
|
|
343
345
|
if ("stream" !== task.kind) return null;
|
|
@@ -345,7 +347,7 @@ function setupStreamParser(task) {
|
|
|
345
347
|
if (task.consumerError) return;
|
|
346
348
|
try {
|
|
347
349
|
var row = JSON.parse(rawRow);
|
|
348
|
-
if ((void 0 === row ? "undefined" : _type_of(row)) === "object" && null !== row && TOKEN_COLUMN in row) return void
|
|
350
|
+
if ((void 0 === row ? "undefined" : _type_of(row)) === "object" && null !== row && TOKEN_COLUMN in row) return void pipelineOrFeed.feed("[".concat(rawRow, "]"));
|
|
349
351
|
task.onRow(row);
|
|
350
352
|
} catch (error) {
|
|
351
353
|
task.consumerError = toError(error);
|
|
@@ -546,10 +548,12 @@ function createTransactionHandle(scopeId, executor) {
|
|
|
546
548
|
};
|
|
547
549
|
return handle;
|
|
548
550
|
}
|
|
549
|
-
|
|
551
|
+
function isWindows() {
|
|
552
|
+
return "win32" === __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__["default"].platform();
|
|
553
|
+
}
|
|
550
554
|
function isExecutable(filePath) {
|
|
551
555
|
try {
|
|
552
|
-
if (isWindows) return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].statSync(filePath).isFile();
|
|
556
|
+
if (isWindows()) return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].statSync(filePath).isFile();
|
|
553
557
|
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].accessSync(filePath, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].constants.X_OK);
|
|
554
558
|
return true;
|
|
555
559
|
} catch (e) {
|
|
@@ -557,7 +561,7 @@ function isExecutable(filePath) {
|
|
|
557
561
|
}
|
|
558
562
|
}
|
|
559
563
|
function getPathExts() {
|
|
560
|
-
if (!isWindows) return [
|
|
564
|
+
if (!isWindows()) return [
|
|
561
565
|
""
|
|
562
566
|
];
|
|
563
567
|
var ext = process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM;.PS1";
|
|
@@ -570,7 +574,7 @@ function which(command) {
|
|
|
570
574
|
var pathExts = getPathExts();
|
|
571
575
|
if (command.includes(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep)) {
|
|
572
576
|
var fullPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(command);
|
|
573
|
-
if (!isWindows) return isExecutable(fullPath) ? fullPath : null;
|
|
577
|
+
if (!isWindows()) return isExecutable(fullPath) ? fullPath : null;
|
|
574
578
|
if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(fullPath)) return isExecutable(fullPath) ? fullPath : null;
|
|
575
579
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
576
580
|
try {
|
|
@@ -597,7 +601,7 @@ function which(command) {
|
|
|
597
601
|
try {
|
|
598
602
|
for(var _iterator1 = pathDirs[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
599
603
|
var dir = _step1.value;
|
|
600
|
-
if (dir) if (isWindows) {
|
|
604
|
+
if (dir) if (isWindows()) {
|
|
601
605
|
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
602
606
|
try {
|
|
603
607
|
for(var _iterator2 = pathExts[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
@@ -692,6 +696,14 @@ function process_class_private_field_set(receiver, privateMap, value) {
|
|
|
692
696
|
process_class_apply_descriptor_set(receiver, descriptor, value);
|
|
693
697
|
return value;
|
|
694
698
|
}
|
|
699
|
+
function _class_private_method_get(receiver, privateSet, fn) {
|
|
700
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
701
|
+
return fn;
|
|
702
|
+
}
|
|
703
|
+
function _class_private_method_init(obj, privateSet) {
|
|
704
|
+
process_check_private_redeclaration(obj, privateSet);
|
|
705
|
+
privateSet.add(obj);
|
|
706
|
+
}
|
|
695
707
|
function process_defineProperties(target, props) {
|
|
696
708
|
for(var i = 0; i < props.length; i++){
|
|
697
709
|
var descriptor = props[i];
|
|
@@ -798,12 +810,14 @@ function _ts_generator(thisArg, body) {
|
|
|
798
810
|
}
|
|
799
811
|
}
|
|
800
812
|
var GRACEFUL_SHUTDOWN_TIMEOUT = 5000;
|
|
801
|
-
var _binary = /*#__PURE__*/ new WeakMap(), _database = /*#__PURE__*/ new WeakMap(), _proc = /*#__PURE__*/ new WeakMap(), _initMode = /*#__PURE__*/ new WeakMap(), _draining = /*#__PURE__*/ new WeakMap(), _onDrain = /*#__PURE__*/ new WeakMap();
|
|
813
|
+
var _binary = /*#__PURE__*/ new WeakMap(), _database = /*#__PURE__*/ new WeakMap(), _proc = /*#__PURE__*/ new WeakMap(), _initMode = /*#__PURE__*/ new WeakMap(), _draining = /*#__PURE__*/ new WeakMap(), _writeBuffer = /*#__PURE__*/ new WeakMap(), _drainCallbacks = /*#__PURE__*/ new WeakMap(), _onDrain = /*#__PURE__*/ new WeakMap(), _flushBuffer = /*#__PURE__*/ new WeakSet(), _notifyIfDrained = /*#__PURE__*/ new WeakSet();
|
|
802
814
|
var process_ProcessManager = /*#__PURE__*/ function() {
|
|
803
815
|
"use strict";
|
|
804
816
|
function ProcessManager() {
|
|
805
817
|
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, binary = _ref.binary, database = _ref.database, _ref_initMode = _ref.initMode, initMode = void 0 === _ref_initMode ? "wal" : _ref_initMode, onDrain = _ref.onDrain;
|
|
806
818
|
process_class_call_check(this, ProcessManager);
|
|
819
|
+
_class_private_method_init(this, _flushBuffer);
|
|
820
|
+
_class_private_method_init(this, _notifyIfDrained);
|
|
807
821
|
process_class_private_field_init(this, _binary, {
|
|
808
822
|
writable: true,
|
|
809
823
|
value: void 0
|
|
@@ -824,6 +838,14 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
824
838
|
writable: true,
|
|
825
839
|
value: false
|
|
826
840
|
});
|
|
841
|
+
process_class_private_field_init(this, _writeBuffer, {
|
|
842
|
+
writable: true,
|
|
843
|
+
value: []
|
|
844
|
+
});
|
|
845
|
+
process_class_private_field_init(this, _drainCallbacks, {
|
|
846
|
+
writable: true,
|
|
847
|
+
value: []
|
|
848
|
+
});
|
|
827
849
|
process_class_private_field_init(this, _onDrain, {
|
|
828
850
|
writable: true,
|
|
829
851
|
value: void 0
|
|
@@ -847,6 +869,13 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
847
869
|
process_class_private_field_set(this, _onDrain, fn);
|
|
848
870
|
}
|
|
849
871
|
},
|
|
872
|
+
{
|
|
873
|
+
key: "onDrained",
|
|
874
|
+
value: function(callback) {
|
|
875
|
+
if (!process_class_private_field_get(this, _draining) && 0 === process_class_private_field_get(this, _writeBuffer).length) return void callback();
|
|
876
|
+
process_class_private_field_get(this, _drainCallbacks).push(callback);
|
|
877
|
+
}
|
|
878
|
+
},
|
|
850
879
|
{
|
|
851
880
|
key: "binary",
|
|
852
881
|
get: function() {
|
|
@@ -862,9 +891,9 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
862
891
|
{
|
|
863
892
|
key: "start",
|
|
864
893
|
value: function() {
|
|
865
|
-
var _proc_stdin, _proc_stdout, _proc_stderr;
|
|
894
|
+
var _proc_stdin, _proc_stdout, _proc_stderr, _proc_stdin1;
|
|
866
895
|
if (!process_class_private_field_get(this, _binary)) throw new Error("sqlite3 binary path is empty. Provide a valid --binary / binary option.");
|
|
867
|
-
if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(process_class_private_field_get(this, _binary))) throw new Error("sqlite3 binary not found: ".concat(process_class_private_field_get(this, _binary), ". Make sure sqlite3 is installed or provide a valid --binary / binary option."));
|
|
896
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(process_class_private_field_get(this, _binary)) && !__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(process_class_private_field_get(this, _binary))) throw new Error("sqlite3 binary not found: ".concat(process_class_private_field_get(this, _binary), ". Make sure sqlite3 is installed or provide a valid --binary / binary option."));
|
|
868
897
|
var args = [
|
|
869
898
|
"-json"
|
|
870
899
|
];
|
|
@@ -881,6 +910,7 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
881
910
|
null == (_proc_stdin = proc.stdin) || _proc_stdin.setDefaultEncoding("utf-8");
|
|
882
911
|
null == (_proc_stdout = proc.stdout) || _proc_stdout.setEncoding("utf-8");
|
|
883
912
|
null == (_proc_stderr = proc.stderr) || _proc_stderr.setEncoding("utf-8");
|
|
913
|
+
null == (_proc_stdin1 = proc.stdin) || _proc_stdin1.on("error", function() {});
|
|
884
914
|
process_class_private_field_set(this, _proc, proc);
|
|
885
915
|
return proc;
|
|
886
916
|
}
|
|
@@ -892,11 +922,13 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
892
922
|
var _$_class_private_field_get;
|
|
893
923
|
var stream = null == (_$_class_private_field_get = process_class_private_field_get(this, _proc)) ? void 0 : _$_class_private_field_get.stdin;
|
|
894
924
|
if (!stream) return;
|
|
895
|
-
if (process_class_private_field_get(this, _draining)) return;
|
|
925
|
+
if (process_class_private_field_get(this, _draining)) return void process_class_private_field_get(this, _writeBuffer).push(data);
|
|
896
926
|
if (!stream.write(data)) {
|
|
897
927
|
process_class_private_field_set(this, _draining, true);
|
|
898
928
|
stream.once("drain", function() {
|
|
899
929
|
process_class_private_field_set(_this, _draining, false);
|
|
930
|
+
_class_private_method_get(_this, _flushBuffer, flushBuffer).call(_this);
|
|
931
|
+
_class_private_method_get(_this, _notifyIfDrained, notifyIfDrained).call(_this);
|
|
900
932
|
process_class_private_field_get(_this, _onDrain).call(_this);
|
|
901
933
|
});
|
|
902
934
|
}
|
|
@@ -915,40 +947,58 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
915
947
|
if (!proc) return [
|
|
916
948
|
2
|
|
917
949
|
];
|
|
950
|
+
if (!(process_class_private_field_get(_this, _draining) || process_class_private_field_get(_this, _writeBuffer).length > 0)) return [
|
|
951
|
+
3,
|
|
952
|
+
2
|
|
953
|
+
];
|
|
954
|
+
return [
|
|
955
|
+
4,
|
|
956
|
+
new Promise(function(resolve) {
|
|
957
|
+
var timer = setTimeout(resolve, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
958
|
+
_this.onDrained(function() {
|
|
959
|
+
clearTimeout(timer);
|
|
960
|
+
resolve();
|
|
961
|
+
});
|
|
962
|
+
})
|
|
963
|
+
];
|
|
964
|
+
case 1:
|
|
965
|
+
_state.sent();
|
|
966
|
+
_state.label = 2;
|
|
967
|
+
case 2:
|
|
918
968
|
timer = setTimeout(function() {
|
|
919
969
|
proc.kill();
|
|
920
|
-
}, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
921
|
-
_state.label =
|
|
922
|
-
case
|
|
970
|
+
}, GRACEFUL_SHUTDOWN_TIMEOUT).unref();
|
|
971
|
+
_state.label = 3;
|
|
972
|
+
case 3:
|
|
923
973
|
_state.trys.push([
|
|
924
|
-
1,
|
|
925
974
|
3,
|
|
926
|
-
|
|
927
|
-
|
|
975
|
+
5,
|
|
976
|
+
6,
|
|
977
|
+
7
|
|
928
978
|
]);
|
|
929
979
|
null == (_proc_stdin = proc.stdin) || _proc_stdin.write(".quit\n");
|
|
930
980
|
return [
|
|
931
981
|
4,
|
|
932
982
|
(0, __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__.once)(proc, "close")
|
|
933
983
|
];
|
|
934
|
-
case
|
|
984
|
+
case 4:
|
|
935
985
|
_state.sent();
|
|
936
986
|
return [
|
|
937
987
|
3,
|
|
938
|
-
|
|
988
|
+
7
|
|
939
989
|
];
|
|
940
|
-
case
|
|
990
|
+
case 5:
|
|
941
991
|
_state.sent();
|
|
942
992
|
return [
|
|
943
993
|
3,
|
|
944
|
-
|
|
994
|
+
7
|
|
945
995
|
];
|
|
946
|
-
case
|
|
996
|
+
case 6:
|
|
947
997
|
clearTimeout(timer);
|
|
948
998
|
return [
|
|
949
999
|
7
|
|
950
1000
|
];
|
|
951
|
-
case
|
|
1001
|
+
case 7:
|
|
952
1002
|
return [
|
|
953
1003
|
2
|
|
954
1004
|
];
|
|
@@ -965,6 +1015,8 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
965
1015
|
if (!proc) return null;
|
|
966
1016
|
process_class_private_field_set(this, _proc, null);
|
|
967
1017
|
process_class_private_field_set(this, _draining, false);
|
|
1018
|
+
process_class_private_field_set(this, _writeBuffer, []);
|
|
1019
|
+
process_class_private_field_set(this, _drainCallbacks, []);
|
|
968
1020
|
null == (_proc_stdout = proc.stdout) || _proc_stdout.removeAllListeners();
|
|
969
1021
|
null == (_proc_stderr = proc.stderr) || _proc_stderr.removeAllListeners();
|
|
970
1022
|
proc.removeAllListeners();
|
|
@@ -976,6 +1028,47 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
976
1028
|
]);
|
|
977
1029
|
return ProcessManager;
|
|
978
1030
|
}();
|
|
1031
|
+
function flushBuffer() {
|
|
1032
|
+
var buffer = process_class_private_field_get(this, _writeBuffer);
|
|
1033
|
+
process_class_private_field_set(this, _writeBuffer, []);
|
|
1034
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1035
|
+
try {
|
|
1036
|
+
for(var _iterator = buffer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1037
|
+
var data = _step.value;
|
|
1038
|
+
this.write(data);
|
|
1039
|
+
}
|
|
1040
|
+
} catch (err) {
|
|
1041
|
+
_didIteratorError = true;
|
|
1042
|
+
_iteratorError = err;
|
|
1043
|
+
} finally{
|
|
1044
|
+
try {
|
|
1045
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1046
|
+
} finally{
|
|
1047
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function notifyIfDrained() {
|
|
1052
|
+
if (process_class_private_field_get(this, _draining)) return;
|
|
1053
|
+
var callbacks = process_class_private_field_get(this, _drainCallbacks);
|
|
1054
|
+
process_class_private_field_set(this, _drainCallbacks, []);
|
|
1055
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1056
|
+
try {
|
|
1057
|
+
for(var _iterator = callbacks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1058
|
+
var cb = _step.value;
|
|
1059
|
+
cb();
|
|
1060
|
+
}
|
|
1061
|
+
} catch (err) {
|
|
1062
|
+
_didIteratorError = true;
|
|
1063
|
+
_iteratorError = err;
|
|
1064
|
+
} finally{
|
|
1065
|
+
try {
|
|
1066
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1067
|
+
} finally{
|
|
1068
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
979
1072
|
var _counter = 0;
|
|
980
1073
|
var _PREFIX = "__executor_end__";
|
|
981
1074
|
var _PID36 = process.pid.toString(36);
|
|
@@ -1073,7 +1166,8 @@ var lruCache_LRUCache = /*#__PURE__*/ function() {
|
|
|
1073
1166
|
key: "set",
|
|
1074
1167
|
value: function(key, value) {
|
|
1075
1168
|
if ("string" != typeof key || key.length > lruCache_class_private_field_get(this, _maxKeyLength)) return;
|
|
1076
|
-
if (value && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1169
|
+
if ("string" == typeof value && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1170
|
+
if (Array.isArray(value) && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1077
1171
|
if (lruCache_class_private_field_get(this, _map).size >= lruCache_class_private_field_get(this, _maxSize)) {
|
|
1078
1172
|
var firstKey = lruCache_class_private_field_get(this, _map).keys().next().value;
|
|
1079
1173
|
lruCache_class_private_field_get(this, _map)["delete"](firstKey);
|
|
@@ -1139,7 +1233,19 @@ var constants_STATE_SINGLE_QUOTE = 1;
|
|
|
1139
1233
|
var constants_STATE_DOUBLE_QUOTE = 2;
|
|
1140
1234
|
var constants_STATE_LINE_COMMENT = 3;
|
|
1141
1235
|
var constants_STATE_BLOCK_COMMENT = 4;
|
|
1142
|
-
|
|
1236
|
+
function _decodeU16(codes) {
|
|
1237
|
+
var len = codes.length;
|
|
1238
|
+
if (0 === len) return "";
|
|
1239
|
+
var batchSize = 1024;
|
|
1240
|
+
if (len <= batchSize) return String.fromCharCode.apply(null, codes);
|
|
1241
|
+
var parts = new Array(Math.ceil(len / batchSize));
|
|
1242
|
+
for(var i = 0; i < parts.length; i++){
|
|
1243
|
+
var start = i * batchSize;
|
|
1244
|
+
var end = Math.min(start + batchSize, len);
|
|
1245
|
+
parts[i] = String.fromCharCode.apply(null, codes.subarray(start, end));
|
|
1246
|
+
}
|
|
1247
|
+
return parts.join("");
|
|
1248
|
+
}
|
|
1143
1249
|
var _normCache = new lruCache_LRUCache({
|
|
1144
1250
|
maxSize: 256,
|
|
1145
1251
|
maxKeyLength: 4096
|
|
@@ -1220,7 +1326,7 @@ function _normalize(sql) {
|
|
|
1220
1326
|
else {
|
|
1221
1327
|
while(writePos > 0 && outCodes[writePos - 1] === CC_SEMICOLON)writePos--;
|
|
1222
1328
|
outCodes[writePos++] = CC_SEMICOLON;
|
|
1223
|
-
normalized =
|
|
1329
|
+
normalized = _decodeU16(outCodes.subarray(0, writePos));
|
|
1224
1330
|
}
|
|
1225
1331
|
var paramCount = questionPositions.length;
|
|
1226
1332
|
if (0 === paramCount) return {
|
|
@@ -1282,8 +1388,8 @@ var _classifyCache = new lruCache_LRUCache({
|
|
|
1282
1388
|
});
|
|
1283
1389
|
function classifySingle(stmt) {
|
|
1284
1390
|
var trimmed = stmt.trim();
|
|
1285
|
-
|
|
1286
|
-
var kind = trimmed.
|
|
1391
|
+
var firstSpace = trimmed.indexOf(" ");
|
|
1392
|
+
var kind = (-1 === firstSpace ? trimmed : trimmed.slice(0, firstSpace)).toUpperCase();
|
|
1287
1393
|
return READ_ONLY_KINDS.has(kind) ? "read" : "write";
|
|
1288
1394
|
}
|
|
1289
1395
|
function classifySQL(sql) {
|
|
@@ -1376,11 +1482,11 @@ function queue_class_private_field_update(receiver, privateMap) {
|
|
|
1376
1482
|
var descriptor = queue_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1377
1483
|
return queue_class_apply_descriptor_update(receiver, descriptor);
|
|
1378
1484
|
}
|
|
1379
|
-
function
|
|
1485
|
+
function queue_class_private_method_get(receiver, privateSet, fn) {
|
|
1380
1486
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1381
1487
|
return fn;
|
|
1382
1488
|
}
|
|
1383
|
-
function
|
|
1489
|
+
function queue_class_private_method_init(obj, privateSet) {
|
|
1384
1490
|
queue_check_private_redeclaration(obj, privateSet);
|
|
1385
1491
|
privateSet.add(obj);
|
|
1386
1492
|
}
|
|
@@ -1499,8 +1605,8 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1499
1605
|
"use strict";
|
|
1500
1606
|
function Queue() {
|
|
1501
1607
|
queue_class_call_check(this, Queue);
|
|
1502
|
-
|
|
1503
|
-
|
|
1608
|
+
queue_class_private_method_init(this, _grow);
|
|
1609
|
+
queue_class_private_method_init(this, _shrinkIfNeeded);
|
|
1504
1610
|
queue_class_private_field_init(this, _items, {
|
|
1505
1611
|
writable: true,
|
|
1506
1612
|
value: new Array(INITIAL_CAPACITY)
|
|
@@ -1526,7 +1632,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1526
1632
|
{
|
|
1527
1633
|
key: "enqueue",
|
|
1528
1634
|
value: function(value) {
|
|
1529
|
-
if (queue_class_private_field_get(this, _size) === queue_class_private_field_get(this, _items).length)
|
|
1635
|
+
if (queue_class_private_field_get(this, _size) === queue_class_private_field_get(this, _items).length) queue_class_private_method_get(this, _grow, grow).call(this);
|
|
1530
1636
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = value;
|
|
1531
1637
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) + 1 & queue_class_private_field_get(this, _mask));
|
|
1532
1638
|
queue_class_private_field_update(this, _size).value++;
|
|
@@ -1550,7 +1656,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1550
1656
|
queue_class_private_field_set(this, _head, 0);
|
|
1551
1657
|
queue_class_private_field_set(this, _tail, 0);
|
|
1552
1658
|
queue_class_private_field_set(this, _size, 0);
|
|
1553
|
-
|
|
1659
|
+
queue_class_private_method_get(this, _shrinkIfNeeded, shrinkIfNeeded).call(this);
|
|
1554
1660
|
}
|
|
1555
1661
|
},
|
|
1556
1662
|
{
|
|
@@ -1711,6 +1817,229 @@ function shrinkIfNeeded() {
|
|
|
1711
1817
|
queue_class_private_field_set(this, _mask, INITIAL_CAPACITY - 1);
|
|
1712
1818
|
}
|
|
1713
1819
|
}
|
|
1820
|
+
function _array_like_to_array(arr, len) {
|
|
1821
|
+
if (null == len || len > arr.length) len = arr.length;
|
|
1822
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1823
|
+
return arr2;
|
|
1824
|
+
}
|
|
1825
|
+
function _array_without_holes(arr) {
|
|
1826
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1827
|
+
}
|
|
1828
|
+
function inflightTracker_check_private_redeclaration(obj, privateCollection) {
|
|
1829
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1830
|
+
}
|
|
1831
|
+
function inflightTracker_class_apply_descriptor_get(receiver, descriptor) {
|
|
1832
|
+
if (descriptor.get) return descriptor.get.call(receiver);
|
|
1833
|
+
return descriptor.value;
|
|
1834
|
+
}
|
|
1835
|
+
function inflightTracker_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
1836
|
+
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
1837
|
+
else {
|
|
1838
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1839
|
+
descriptor.value = value;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
function inflightTracker_class_apply_descriptor_update(receiver, descriptor) {
|
|
1843
|
+
if (descriptor.set) {
|
|
1844
|
+
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1845
|
+
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
1846
|
+
set value (v){
|
|
1847
|
+
descriptor.set.call(receiver, v);
|
|
1848
|
+
},
|
|
1849
|
+
get value () {
|
|
1850
|
+
return descriptor.get.call(receiver);
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1853
|
+
return descriptor.__destrWrapper;
|
|
1854
|
+
}
|
|
1855
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1856
|
+
return descriptor;
|
|
1857
|
+
}
|
|
1858
|
+
function inflightTracker_class_call_check(instance, Constructor) {
|
|
1859
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1860
|
+
}
|
|
1861
|
+
function inflightTracker_class_extract_field_descriptor(receiver, privateMap, action) {
|
|
1862
|
+
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
1863
|
+
return privateMap.get(receiver);
|
|
1864
|
+
}
|
|
1865
|
+
function inflightTracker_class_private_field_get(receiver, privateMap) {
|
|
1866
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "get");
|
|
1867
|
+
return inflightTracker_class_apply_descriptor_get(receiver, descriptor);
|
|
1868
|
+
}
|
|
1869
|
+
function inflightTracker_class_private_field_init(obj, privateMap, value) {
|
|
1870
|
+
inflightTracker_check_private_redeclaration(obj, privateMap);
|
|
1871
|
+
privateMap.set(obj, value);
|
|
1872
|
+
}
|
|
1873
|
+
function inflightTracker_class_private_field_set(receiver, privateMap, value) {
|
|
1874
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
1875
|
+
inflightTracker_class_apply_descriptor_set(receiver, descriptor, value);
|
|
1876
|
+
return value;
|
|
1877
|
+
}
|
|
1878
|
+
function inflightTracker_class_private_field_update(receiver, privateMap) {
|
|
1879
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1880
|
+
return inflightTracker_class_apply_descriptor_update(receiver, descriptor);
|
|
1881
|
+
}
|
|
1882
|
+
function inflightTracker_defineProperties(target, props) {
|
|
1883
|
+
for(var i = 0; i < props.length; i++){
|
|
1884
|
+
var descriptor = props[i];
|
|
1885
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1886
|
+
descriptor.configurable = true;
|
|
1887
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1888
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
function inflightTracker_create_class(Constructor, protoProps, staticProps) {
|
|
1892
|
+
if (protoProps) inflightTracker_defineProperties(Constructor.prototype, protoProps);
|
|
1893
|
+
if (staticProps) inflightTracker_defineProperties(Constructor, staticProps);
|
|
1894
|
+
return Constructor;
|
|
1895
|
+
}
|
|
1896
|
+
function _iterable_to_array(iter) {
|
|
1897
|
+
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
1898
|
+
}
|
|
1899
|
+
function _non_iterable_spread() {
|
|
1900
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1901
|
+
}
|
|
1902
|
+
function _to_consumable_array(arr) {
|
|
1903
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
1904
|
+
}
|
|
1905
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
1906
|
+
if (!o) return;
|
|
1907
|
+
if ("string" == typeof o) return _array_like_to_array(o, minLen);
|
|
1908
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1909
|
+
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
1910
|
+
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
1911
|
+
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1912
|
+
}
|
|
1913
|
+
var _tasks = /*#__PURE__*/ new WeakMap(), inflightTracker_head = /*#__PURE__*/ new WeakMap();
|
|
1914
|
+
var inflightTracker_InflightTracker = /*#__PURE__*/ function() {
|
|
1915
|
+
"use strict";
|
|
1916
|
+
function InflightTracker() {
|
|
1917
|
+
inflightTracker_class_call_check(this, InflightTracker);
|
|
1918
|
+
inflightTracker_class_private_field_init(this, _tasks, {
|
|
1919
|
+
writable: true,
|
|
1920
|
+
value: []
|
|
1921
|
+
});
|
|
1922
|
+
inflightTracker_class_private_field_init(this, inflightTracker_head, {
|
|
1923
|
+
writable: true,
|
|
1924
|
+
value: 0
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
inflightTracker_create_class(InflightTracker, [
|
|
1928
|
+
{
|
|
1929
|
+
key: "count",
|
|
1930
|
+
get: function() {
|
|
1931
|
+
return inflightTracker_class_private_field_get(this, _tasks).length - inflightTracker_class_private_field_get(this, inflightTracker_head);
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
key: "first",
|
|
1936
|
+
get: function() {
|
|
1937
|
+
return inflightTracker_class_private_field_get(this, inflightTracker_head) < inflightTracker_class_private_field_get(this, _tasks).length ? inflightTracker_class_private_field_get(this, _tasks)[inflightTracker_class_private_field_get(this, inflightTracker_head)] : null;
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
key: "push",
|
|
1942
|
+
value: function() {
|
|
1943
|
+
for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++)items[_key] = arguments[_key];
|
|
1944
|
+
var _$_class_private_field_get;
|
|
1945
|
+
(_$_class_private_field_get = inflightTracker_class_private_field_get(this, _tasks)).push.apply(_$_class_private_field_get, _to_consumable_array(items));
|
|
1946
|
+
}
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
key: "shift",
|
|
1950
|
+
value: function() {
|
|
1951
|
+
if (inflightTracker_class_private_field_get(this, _tasks).length === inflightTracker_class_private_field_get(this, inflightTracker_head)) return null;
|
|
1952
|
+
var task = inflightTracker_class_private_field_get(this, _tasks)[inflightTracker_class_private_field_get(this, inflightTracker_head)];
|
|
1953
|
+
inflightTracker_class_private_field_get(this, _tasks)[inflightTracker_class_private_field_get(this, inflightTracker_head)] = null;
|
|
1954
|
+
inflightTracker_class_private_field_update(this, inflightTracker_head).value++;
|
|
1955
|
+
if (inflightTracker_class_private_field_get(this, inflightTracker_head) >= inflightTracker_class_private_field_get(this, _tasks).length) {
|
|
1956
|
+
inflightTracker_class_private_field_set(this, _tasks, []);
|
|
1957
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
1958
|
+
} else if (inflightTracker_class_private_field_get(this, inflightTracker_head) > INFLIGHT_COMPACT_THRESHOLD) {
|
|
1959
|
+
inflightTracker_class_private_field_set(this, _tasks, inflightTracker_class_private_field_get(this, _tasks).slice(inflightTracker_class_private_field_get(this, inflightTracker_head)));
|
|
1960
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
1961
|
+
}
|
|
1962
|
+
return task;
|
|
1963
|
+
}
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
key: "clear",
|
|
1967
|
+
value: function() {
|
|
1968
|
+
inflightTracker_class_private_field_set(this, _tasks, []);
|
|
1969
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
1970
|
+
}
|
|
1971
|
+
},
|
|
1972
|
+
{
|
|
1973
|
+
key: "forEach",
|
|
1974
|
+
value: function(fn) {
|
|
1975
|
+
for(var i = inflightTracker_class_private_field_get(this, inflightTracker_head); i < inflightTracker_class_private_field_get(this, _tasks).length; i++)fn(inflightTracker_class_private_field_get(this, _tasks)[i]);
|
|
1976
|
+
}
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
key: "toArray",
|
|
1980
|
+
value: function() {
|
|
1981
|
+
return inflightTracker_class_private_field_get(this, _tasks).slice(inflightTracker_class_private_field_get(this, inflightTracker_head));
|
|
1982
|
+
}
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
key: "_tasksLength",
|
|
1986
|
+
get: function() {
|
|
1987
|
+
return inflightTracker_class_private_field_get(this, _tasks).length;
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
key: "_head",
|
|
1992
|
+
get: function() {
|
|
1993
|
+
return inflightTracker_class_private_field_get(this, inflightTracker_head);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
]);
|
|
1997
|
+
return InflightTracker;
|
|
1998
|
+
}();
|
|
1999
|
+
function collectQueryRows(task, parsed) {
|
|
2000
|
+
if (Array.isArray(parsed)) for(var i = 0; i < parsed.length; i++)task.rows.push(parsed[i]);
|
|
2001
|
+
}
|
|
2002
|
+
function processStreamRows(task, parsed) {
|
|
2003
|
+
if (!Array.isArray(parsed)) return;
|
|
2004
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2005
|
+
try {
|
|
2006
|
+
for(var _iterator = parsed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2007
|
+
var row = _step.value;
|
|
2008
|
+
if (task.consumerError) break;
|
|
2009
|
+
try {
|
|
2010
|
+
task.onRow(row);
|
|
2011
|
+
} catch (error) {
|
|
2012
|
+
task.consumerError = toError(error);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
} catch (err) {
|
|
2016
|
+
_didIteratorError = true;
|
|
2017
|
+
_iteratorError = err;
|
|
2018
|
+
} finally{
|
|
2019
|
+
try {
|
|
2020
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2021
|
+
} finally{
|
|
2022
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
function settleUtils_settleTask(task, error, value, metrics) {
|
|
2027
|
+
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
2028
|
+
if (task.settled) return;
|
|
2029
|
+
task.settled = true;
|
|
2030
|
+
if (resetRowParser) {
|
|
2031
|
+
var _task_rowParser_reset, _task_rowParser;
|
|
2032
|
+
null == (_task_rowParser = task.rowParser) || null == (_task_rowParser_reset = _task_rowParser.reset) || _task_rowParser_reset.call(_task_rowParser);
|
|
2033
|
+
}
|
|
2034
|
+
if (error) {
|
|
2035
|
+
null == metrics || metrics.incrementTasksFailed();
|
|
2036
|
+
task.reject(toError(error));
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
var duration = task.startTime > 0 ? performance.now() - task.startTime : 0;
|
|
2040
|
+
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
2041
|
+
task.resolve(value);
|
|
2042
|
+
}
|
|
1714
2043
|
function buildPayload(sql, token) {
|
|
1715
2044
|
var _ref = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, _ref_skipNormalize = _ref.skipNormalize, skipNormalize = void 0 === _ref_skipNormalize ? false : _ref_skipNormalize;
|
|
1716
2045
|
var normalized = skipNormalize ? sql : normalizeSQL(sql);
|
|
@@ -1799,58 +2128,71 @@ function isSentinelRow(value, token) {
|
|
|
1799
2128
|
var _value_;
|
|
1800
2129
|
return Array.isArray(value) && 1 === value.length && (null == (_value_ = value[0]) ? void 0 : _value_[TOKEN_COLUMN]) === token;
|
|
1801
2130
|
}
|
|
1802
|
-
function
|
|
1803
|
-
if (
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
}
|
|
2131
|
+
function pipelineUtils_array_like_to_array(arr, len) {
|
|
2132
|
+
if (null == len || len > arr.length) len = arr.length;
|
|
2133
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2134
|
+
return arr2;
|
|
1807
2135
|
}
|
|
1808
|
-
function
|
|
1809
|
-
if (
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
2136
|
+
function pipelineUtils_array_without_holes(arr) {
|
|
2137
|
+
if (Array.isArray(arr)) return pipelineUtils_array_like_to_array(arr);
|
|
2138
|
+
}
|
|
2139
|
+
function pipelineUtils_iterable_to_array(iter) {
|
|
2140
|
+
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
2141
|
+
}
|
|
2142
|
+
function pipelineUtils_non_iterable_spread() {
|
|
2143
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2144
|
+
}
|
|
2145
|
+
function pipelineUtils_to_consumable_array(arr) {
|
|
2146
|
+
return pipelineUtils_array_without_holes(arr) || pipelineUtils_iterable_to_array(arr) || pipelineUtils_unsupported_iterable_to_array(arr) || pipelineUtils_non_iterable_spread();
|
|
2147
|
+
}
|
|
2148
|
+
function pipelineUtils_unsupported_iterable_to_array(o, minLen) {
|
|
2149
|
+
if (!o) return;
|
|
2150
|
+
if ("string" == typeof o) return pipelineUtils_array_like_to_array(o, minLen);
|
|
2151
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2152
|
+
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
2153
|
+
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
2154
|
+
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineUtils_array_like_to_array(o, minLen);
|
|
2155
|
+
}
|
|
2156
|
+
function finalizePendingTasks(tasks, settle, pumpQueue, pendingStderr, inflight) {
|
|
2157
|
+
var hasStderrBuffer = pendingStderr && pendingStderr.length > 0;
|
|
2158
|
+
if (hasStderrBuffer) {
|
|
2159
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1825
2160
|
try {
|
|
1826
|
-
|
|
2161
|
+
for(var _iterator = pendingStderr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2162
|
+
var chunk = _step.value;
|
|
2163
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2164
|
+
try {
|
|
2165
|
+
for(var _iterator1 = tasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2166
|
+
var t = _step1.value;
|
|
2167
|
+
if ("query" === t.kind && 0 === t.rows.length) t.stderrText += chunk;
|
|
2168
|
+
}
|
|
2169
|
+
} catch (err) {
|
|
2170
|
+
_didIteratorError1 = true;
|
|
2171
|
+
_iteratorError1 = err;
|
|
2172
|
+
} finally{
|
|
2173
|
+
try {
|
|
2174
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2175
|
+
} finally{
|
|
2176
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
} catch (err) {
|
|
2181
|
+
_didIteratorError = true;
|
|
2182
|
+
_iteratorError = err;
|
|
1827
2183
|
} finally{
|
|
1828
|
-
|
|
2184
|
+
try {
|
|
2185
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2186
|
+
} finally{
|
|
2187
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2188
|
+
}
|
|
1829
2189
|
}
|
|
2190
|
+
if (!inflight || 0 === inflight.count) pendingStderr.length = 0;
|
|
1830
2191
|
}
|
|
1831
|
-
|
|
1832
|
-
function settleTask(task, error, value, metrics) {
|
|
1833
|
-
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
1834
|
-
if (task.settled) return;
|
|
1835
|
-
task.settled = true;
|
|
1836
|
-
if (resetRowParser) {
|
|
1837
|
-
var _task_rowParser_reset, _task_rowParser;
|
|
1838
|
-
null == (_task_rowParser = task.rowParser) || null == (_task_rowParser_reset = _task_rowParser.reset) || _task_rowParser_reset.call(_task_rowParser);
|
|
1839
|
-
}
|
|
1840
|
-
if (error) {
|
|
1841
|
-
null == metrics || metrics.incrementTasksFailed();
|
|
1842
|
-
task.reject(toError(error));
|
|
1843
|
-
return;
|
|
1844
|
-
}
|
|
1845
|
-
var duration = task.startTime > 0 ? performance.now() - task.startTime : 0;
|
|
1846
|
-
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
1847
|
-
task.resolve(value);
|
|
1848
|
-
}
|
|
1849
|
-
function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
1850
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2192
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
1851
2193
|
try {
|
|
1852
|
-
for(var
|
|
1853
|
-
var task =
|
|
2194
|
+
for(var _iterator2 = tasks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2195
|
+
var task = _step2.value;
|
|
1854
2196
|
if (task.stderrText) {
|
|
1855
2197
|
settle(task, new Error(task.stderrText.trim()), void 0);
|
|
1856
2198
|
continue;
|
|
@@ -1866,13 +2208,13 @@ function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
|
1866
2208
|
settle(task, null, void 0);
|
|
1867
2209
|
}
|
|
1868
2210
|
} catch (err) {
|
|
1869
|
-
|
|
1870
|
-
|
|
2211
|
+
_didIteratorError2 = true;
|
|
2212
|
+
_iteratorError2 = err;
|
|
1871
2213
|
} finally{
|
|
1872
2214
|
try {
|
|
1873
|
-
if (!
|
|
2215
|
+
if (!_iteratorNormalCompletion2 && null != _iterator2["return"]) _iterator2["return"]();
|
|
1874
2216
|
} finally{
|
|
1875
|
-
if (
|
|
2217
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
1876
2218
|
}
|
|
1877
2219
|
}
|
|
1878
2220
|
tasks.clear();
|
|
@@ -1884,13 +2226,292 @@ function prepareTaskTimeout(task, metrics) {
|
|
|
1884
2226
|
null == metrics || metrics.incrementTasksTimeout();
|
|
1885
2227
|
return createTimeoutError(task.timeout, task.sql);
|
|
1886
2228
|
}
|
|
1887
|
-
function
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
2229
|
+
function createSweeper(param) {
|
|
2230
|
+
var inflight = param.inflight, sweepIntervalMs = param.sweepIntervalMs, handleTaskTimeout = param.handleTaskTimeout;
|
|
2231
|
+
var sweepTimer = null;
|
|
2232
|
+
var schedule = function() {
|
|
2233
|
+
if (sweepTimer) return;
|
|
2234
|
+
sweepTimer = setTimeout(function() {
|
|
2235
|
+
sweepTimer = null;
|
|
2236
|
+
var now = performance.now();
|
|
2237
|
+
inflight.forEach(function(task) {
|
|
2238
|
+
if (now - task.startTime > task.timeout) handleTaskTimeout(task);
|
|
2239
|
+
});
|
|
2240
|
+
if (inflight.count > 0) schedule();
|
|
2241
|
+
}, sweepIntervalMs).unref();
|
|
2242
|
+
};
|
|
2243
|
+
var clear = function() {
|
|
2244
|
+
clearTimeout(sweepTimer);
|
|
2245
|
+
sweepTimer = null;
|
|
2246
|
+
};
|
|
2247
|
+
return {
|
|
2248
|
+
schedule: schedule,
|
|
2249
|
+
clear: clear,
|
|
2250
|
+
getSweepTimer: function() {
|
|
2251
|
+
return sweepTimer;
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
1891
2254
|
}
|
|
1892
|
-
function
|
|
1893
|
-
|
|
2255
|
+
function createFinalizeScheduler(param) {
|
|
2256
|
+
var pendingFinalizeTasks = param.pendingFinalizeTasks, settle = param.settleTask, pumpQueue = param.pumpQueue, pendingStderr = param.pendingStderr, inflight = param.inflight;
|
|
2257
|
+
var scheduled = false;
|
|
2258
|
+
var immediate = null;
|
|
2259
|
+
var cancelled = false;
|
|
2260
|
+
var cancel = function() {
|
|
2261
|
+
cancelled = true;
|
|
2262
|
+
if (immediate) {
|
|
2263
|
+
clearImmediate(immediate);
|
|
2264
|
+
immediate = null;
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
var check = function() {
|
|
2268
|
+
if (cancelled) return;
|
|
2269
|
+
if (scheduled) return;
|
|
2270
|
+
if (0 === pendingFinalizeTasks.size) return;
|
|
2271
|
+
scheduled = true;
|
|
2272
|
+
immediate = setImmediate(function() {
|
|
2273
|
+
immediate = null;
|
|
2274
|
+
if (cancelled) return;
|
|
2275
|
+
finalizePendingTasks(pendingFinalizeTasks, settle, pumpQueue, pendingStderr, inflight);
|
|
2276
|
+
scheduled = false;
|
|
2277
|
+
});
|
|
2278
|
+
};
|
|
2279
|
+
check.cancel = cancel;
|
|
2280
|
+
return check;
|
|
2281
|
+
}
|
|
2282
|
+
function handleParsedValue(raw, inflight, param) {
|
|
2283
|
+
var afterSentinel = param.afterSentinel, rejectAll = param.rejectAll;
|
|
2284
|
+
var task = inflight.first;
|
|
2285
|
+
if (!task) return;
|
|
2286
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
2287
|
+
inflight.shift();
|
|
2288
|
+
afterSentinel(task);
|
|
2289
|
+
return;
|
|
2290
|
+
}
|
|
2291
|
+
if ("[]" === raw) return;
|
|
2292
|
+
var parsed;
|
|
2293
|
+
try {
|
|
2294
|
+
parsed = JSON.parse(raw);
|
|
2295
|
+
} catch (error) {
|
|
2296
|
+
rejectAll(new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
2297
|
+
return;
|
|
2298
|
+
}
|
|
2299
|
+
if (isSentinelRow(parsed, task.token)) {
|
|
2300
|
+
inflight.shift();
|
|
2301
|
+
afterSentinel(task);
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
if (task.timedout) return;
|
|
2305
|
+
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
2306
|
+
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
2307
|
+
}
|
|
2308
|
+
function createPumpQueue(param) {
|
|
2309
|
+
var queue = param.queue, inflight = param.inflight, processManager = param.processManager, sweeper = param.sweeper, batchSize = param.batchSize, maxInflight = param.maxInflight;
|
|
2310
|
+
var nextBatchId = 1;
|
|
2311
|
+
return function pump() {
|
|
2312
|
+
var _inflight;
|
|
2313
|
+
if (processManager.draining) return void processManager.onDrained(function() {
|
|
2314
|
+
return pump();
|
|
2315
|
+
});
|
|
2316
|
+
if (inflight.count >= maxInflight) return;
|
|
2317
|
+
var batch = [];
|
|
2318
|
+
while(batch.length < batchSize && !queue.isEmpty() && inflight.count + batch.length < maxInflight){
|
|
2319
|
+
var task = queue.peek();
|
|
2320
|
+
if ("stream" === task.kind && (batch.length > 0 || inflight.count > 0)) break;
|
|
2321
|
+
queue.dequeue();
|
|
2322
|
+
batch.push(task);
|
|
2323
|
+
}
|
|
2324
|
+
if (0 === batch.length) return;
|
|
2325
|
+
var now = performance.now();
|
|
2326
|
+
var payload = buildBatchPayload(batch);
|
|
2327
|
+
var batchId = nextBatchId++;
|
|
2328
|
+
var useWalBatch = payload.startsWith("BEGIN;");
|
|
2329
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2330
|
+
try {
|
|
2331
|
+
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2332
|
+
var task1 = _step.value;
|
|
2333
|
+
task1.startTime = now;
|
|
2334
|
+
task1.batchId = batchId;
|
|
2335
|
+
task1.walBatch = useWalBatch;
|
|
2336
|
+
}
|
|
2337
|
+
} catch (err) {
|
|
2338
|
+
_didIteratorError = true;
|
|
2339
|
+
_iteratorError = err;
|
|
2340
|
+
} finally{
|
|
2341
|
+
try {
|
|
2342
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2343
|
+
} finally{
|
|
2344
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
(_inflight = inflight).push.apply(_inflight, pipelineUtils_to_consumable_array(batch));
|
|
2348
|
+
sweeper.schedule();
|
|
2349
|
+
processManager.write(payload);
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
function handleSentinelTask(task, param) {
|
|
2353
|
+
var settleTask = param.settleTask, pendingFinalizeTasks = param.pendingFinalizeTasks, scheduleFinalizeCheck = param.scheduleFinalizeCheck, pumpQueue = param.pumpQueue;
|
|
2354
|
+
if (task.timedout) return void pumpQueue();
|
|
2355
|
+
if (task.consumerError) {
|
|
2356
|
+
settleTask(task, task.consumerError, void 0);
|
|
2357
|
+
pumpQueue();
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
pendingFinalizeTasks.add(task);
|
|
2361
|
+
scheduleFinalizeCheck();
|
|
2362
|
+
pumpQueue();
|
|
2363
|
+
}
|
|
2364
|
+
function handleStderrChunk(chunk, param) {
|
|
2365
|
+
var inflight = param.inflight, pendingFinalizeTasks = param.pendingFinalizeTasks, logger = param.logger, pendingStderr = param.pendingStderr;
|
|
2366
|
+
var inflightFirst = inflight.first;
|
|
2367
|
+
var firstPending = pendingFinalizeTasks.values().next().value;
|
|
2368
|
+
var zeroRowMatch = false;
|
|
2369
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2370
|
+
try {
|
|
2371
|
+
for(var _iterator = pendingFinalizeTasks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2372
|
+
var t = _step.value;
|
|
2373
|
+
if ("query" === t.kind && 0 === t.rows.length) {
|
|
2374
|
+
t.stderrText += chunk;
|
|
2375
|
+
zeroRowMatch = true;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
} catch (err) {
|
|
2379
|
+
_didIteratorError = true;
|
|
2380
|
+
_iteratorError = err;
|
|
2381
|
+
} finally{
|
|
2382
|
+
try {
|
|
2383
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2384
|
+
} finally{
|
|
2385
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
if (zeroRowMatch) return;
|
|
2389
|
+
var task = null != inflightFirst ? inflightFirst : firstPending;
|
|
2390
|
+
if (!task) {
|
|
2391
|
+
var _logger_error;
|
|
2392
|
+
null == logger || null == (_logger_error = logger.error) || _logger_error.call(logger, chunk.trim());
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
if (null == task.batchId) {
|
|
2396
|
+
task.stderrText += chunk;
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
if (task.walBatch) {
|
|
2400
|
+
task.stderrText += chunk;
|
|
2401
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2402
|
+
try {
|
|
2403
|
+
for(var _iterator1 = pendingFinalizeTasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2404
|
+
var t1 = _step1.value;
|
|
2405
|
+
if (t1 !== task) t1.stderrText += chunk;
|
|
2406
|
+
}
|
|
2407
|
+
} catch (err) {
|
|
2408
|
+
_didIteratorError1 = true;
|
|
2409
|
+
_iteratorError1 = err;
|
|
2410
|
+
} finally{
|
|
2411
|
+
try {
|
|
2412
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2413
|
+
} finally{
|
|
2414
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
inflight.forEach(function(t) {
|
|
2418
|
+
if (t !== task) t.stderrText += chunk;
|
|
2419
|
+
});
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
if (task === inflightFirst) {
|
|
2423
|
+
if (inflight.count > 1) null == pendingStderr || pendingStderr.push(chunk);
|
|
2424
|
+
else if (pendingFinalizeTasks.size > 0) {
|
|
2425
|
+
var hasZeroRowQuery = false;
|
|
2426
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
2427
|
+
try {
|
|
2428
|
+
for(var _iterator2 = pendingFinalizeTasks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2429
|
+
var t2 = _step2.value;
|
|
2430
|
+
if ("query" === t2.kind && 0 === t2.rows.length) {
|
|
2431
|
+
hasZeroRowQuery = true;
|
|
2432
|
+
break;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
} catch (err) {
|
|
2436
|
+
_didIteratorError2 = true;
|
|
2437
|
+
_iteratorError2 = err;
|
|
2438
|
+
} finally{
|
|
2439
|
+
try {
|
|
2440
|
+
if (!_iteratorNormalCompletion2 && null != _iterator2["return"]) _iterator2["return"]();
|
|
2441
|
+
} finally{
|
|
2442
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
if (hasZeroRowQuery) null == pendingStderr || pendingStderr.push(chunk);
|
|
2446
|
+
else if ("query" === task.kind && task.rows.length > 0) {
|
|
2447
|
+
var _logger_error1;
|
|
2448
|
+
null == logger || null == (_logger_error1 = logger.error) || _logger_error1.call(logger, chunk.trim());
|
|
2449
|
+
} else task.stderrText += chunk;
|
|
2450
|
+
} else if ("query" === task.kind && task.rows.length > 0) {
|
|
2451
|
+
var _logger_error2;
|
|
2452
|
+
null == logger || null == (_logger_error2 = logger.error) || _logger_error2.call(logger, chunk.trim());
|
|
2453
|
+
} else task.stderrText += chunk;
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
|
|
2457
|
+
try {
|
|
2458
|
+
for(var _iterator3 = pendingFinalizeTasks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
2459
|
+
var t3 = _step3.value;
|
|
2460
|
+
t3.stderrText += chunk;
|
|
2461
|
+
}
|
|
2462
|
+
} catch (err) {
|
|
2463
|
+
_didIteratorError3 = true;
|
|
2464
|
+
_iteratorError3 = err;
|
|
2465
|
+
} finally{
|
|
2466
|
+
try {
|
|
2467
|
+
if (!_iteratorNormalCompletion3 && null != _iterator3["return"]) _iterator3["return"]();
|
|
2468
|
+
} finally{
|
|
2469
|
+
if (_didIteratorError3) throw _iteratorError3;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
function rejectAllTasks(param) {
|
|
2474
|
+
var inflight = param.inflight, queue = param.queue, pendingFinalizeTasks = param.pendingFinalizeTasks, settleTask = param.settleTask, error = param.error;
|
|
2475
|
+
var all = inflight.toArray();
|
|
2476
|
+
inflight.clear();
|
|
2477
|
+
var queued = queue.dequeue();
|
|
2478
|
+
while(queued){
|
|
2479
|
+
settleTask(queued, error, void 0);
|
|
2480
|
+
queued = queue.dequeue();
|
|
2481
|
+
}
|
|
2482
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2483
|
+
try {
|
|
2484
|
+
for(var _iterator = all[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2485
|
+
var task = _step.value;
|
|
2486
|
+
settleTask(task, error, void 0);
|
|
2487
|
+
}
|
|
2488
|
+
} catch (err) {
|
|
2489
|
+
_didIteratorError = true;
|
|
2490
|
+
_iteratorError = err;
|
|
2491
|
+
} finally{
|
|
2492
|
+
try {
|
|
2493
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2494
|
+
} finally{
|
|
2495
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2499
|
+
try {
|
|
2500
|
+
for(var _iterator1 = pendingFinalizeTasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2501
|
+
var task1 = _step1.value;
|
|
2502
|
+
settleTask(task1, error, void 0);
|
|
2503
|
+
}
|
|
2504
|
+
} catch (err) {
|
|
2505
|
+
_didIteratorError1 = true;
|
|
2506
|
+
_iteratorError1 = err;
|
|
2507
|
+
} finally{
|
|
2508
|
+
try {
|
|
2509
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2510
|
+
} finally{
|
|
2511
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
pendingFinalizeTasks.clear();
|
|
1894
2515
|
}
|
|
1895
2516
|
function taskWorker_check_private_redeclaration(obj, privateCollection) {
|
|
1896
2517
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -1906,22 +2527,6 @@ function taskWorker_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
1906
2527
|
descriptor.value = value;
|
|
1907
2528
|
}
|
|
1908
2529
|
}
|
|
1909
|
-
function taskWorker_class_apply_descriptor_update(receiver, descriptor) {
|
|
1910
|
-
if (descriptor.set) {
|
|
1911
|
-
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1912
|
-
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
1913
|
-
set value (v){
|
|
1914
|
-
descriptor.set.call(receiver, v);
|
|
1915
|
-
},
|
|
1916
|
-
get value () {
|
|
1917
|
-
return descriptor.get.call(receiver);
|
|
1918
|
-
}
|
|
1919
|
-
};
|
|
1920
|
-
return descriptor.__destrWrapper;
|
|
1921
|
-
}
|
|
1922
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1923
|
-
return descriptor;
|
|
1924
|
-
}
|
|
1925
2530
|
function taskWorker_class_call_check(instance, Constructor) {
|
|
1926
2531
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1927
2532
|
}
|
|
@@ -1942,10 +2547,6 @@ function taskWorker_class_private_field_set(receiver, privateMap, value) {
|
|
|
1942
2547
|
taskWorker_class_apply_descriptor_set(receiver, descriptor, value);
|
|
1943
2548
|
return value;
|
|
1944
2549
|
}
|
|
1945
|
-
function taskWorker_class_private_field_update(receiver, privateMap) {
|
|
1946
|
-
var descriptor = taskWorker_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1947
|
-
return taskWorker_class_apply_descriptor_update(receiver, descriptor);
|
|
1948
|
-
}
|
|
1949
2550
|
function taskWorker_class_private_method_get(receiver, privateSet, fn) {
|
|
1950
2551
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1951
2552
|
return fn;
|
|
@@ -1968,24 +2569,7 @@ function taskWorker_create_class(Constructor, protoProps, staticProps) {
|
|
|
1968
2569
|
if (staticProps) taskWorker_defineProperties(Constructor, staticProps);
|
|
1969
2570
|
return Constructor;
|
|
1970
2571
|
}
|
|
1971
|
-
|
|
1972
|
-
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
1973
|
-
}
|
|
1974
|
-
function _non_iterable_spread() {
|
|
1975
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1976
|
-
}
|
|
1977
|
-
function _to_consumable_array(arr) {
|
|
1978
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
1979
|
-
}
|
|
1980
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
1981
|
-
if (!o) return;
|
|
1982
|
-
if ("string" == typeof o) return _array_like_to_array(o, minLen);
|
|
1983
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1984
|
-
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
1985
|
-
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
1986
|
-
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1987
|
-
}
|
|
1988
|
-
var _processManager = /*#__PURE__*/ new WeakMap(), _pendingQueue = /*#__PURE__*/ new WeakMap(), _inflightTasks = /*#__PURE__*/ new WeakMap(), _inflightHead = /*#__PURE__*/ new WeakMap(), _pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), _scheduledFinalize = /*#__PURE__*/ new WeakMap(), _valueParser = /*#__PURE__*/ new WeakMap(), _statementTimeout = /*#__PURE__*/ new WeakMap(), _logger = /*#__PURE__*/ new WeakMap(), _name = /*#__PURE__*/ new WeakMap(), _batchSize = /*#__PURE__*/ new WeakMap(), _maxInflight = /*#__PURE__*/ new WeakMap(), _metrics = /*#__PURE__*/ new WeakMap(), _sweepTimer = /*#__PURE__*/ new WeakMap(), _sweepIntervalMs = /*#__PURE__*/ new WeakMap(), _startProcess = /*#__PURE__*/ new WeakSet(), _inflightCount = /*#__PURE__*/ new WeakSet(), _firstInflight = /*#__PURE__*/ new WeakSet(), _shiftInflight = /*#__PURE__*/ new WeakSet(), _pumpQueue = /*#__PURE__*/ new WeakSet(), _handleParsedValue = /*#__PURE__*/ new WeakSet(), _scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), _handleStderrChunk = /*#__PURE__*/ new WeakSet(), _scheduleSweep = /*#__PURE__*/ new WeakSet(), _handleTaskTimeout = /*#__PURE__*/ new WeakSet(), _settleTask = /*#__PURE__*/ new WeakSet(), _rejectAll = /*#__PURE__*/ new WeakSet();
|
|
2572
|
+
var _processManager = /*#__PURE__*/ new WeakMap(), _pendingQueue = /*#__PURE__*/ new WeakMap(), taskWorker_inflight = /*#__PURE__*/ new WeakMap(), _pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), _valueParser = /*#__PURE__*/ new WeakMap(), _statementTimeout = /*#__PURE__*/ new WeakMap(), _logger = /*#__PURE__*/ new WeakMap(), _name = /*#__PURE__*/ new WeakMap(), _batchSize = /*#__PURE__*/ new WeakMap(), _maxInflight = /*#__PURE__*/ new WeakMap(), _metrics = /*#__PURE__*/ new WeakMap(), _sweeper = /*#__PURE__*/ new WeakMap(), _scheduleFinalizeCheck = /*#__PURE__*/ new WeakMap(), _pump = /*#__PURE__*/ new WeakMap(), _pendingStderr = /*#__PURE__*/ new WeakMap(), _startProcess = /*#__PURE__*/ new WeakSet(), _pumpQueue = /*#__PURE__*/ new WeakSet(), _afterSentinel = /*#__PURE__*/ new WeakSet(), _handleStderrChunk = /*#__PURE__*/ new WeakSet(), _settleTask = /*#__PURE__*/ new WeakSet(), _rejectAll = /*#__PURE__*/ new WeakSet();
|
|
1989
2573
|
var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
1990
2574
|
"use strict";
|
|
1991
2575
|
function TaskWorker(param) {
|
|
@@ -1993,15 +2577,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
1993
2577
|
var binary = param.binary, database = param.database, statementTimeout = param.statementTimeout, logger = param.logger, name = param.name, initMode = param.initMode, _param_batchSize = param.batchSize, batchSize = void 0 === _param_batchSize ? DEFAULT_BATCH_SIZE : _param_batchSize, _param_maxInflight = param.maxInflight, maxInflight = void 0 === _param_maxInflight ? DEFAULT_MAX_INFLIGHT : _param_maxInflight, metrics = param.metrics, _param_sweepInterval = param.sweepInterval, sweepInterval = void 0 === _param_sweepInterval ? 100 : _param_sweepInterval;
|
|
1994
2578
|
taskWorker_class_call_check(this, TaskWorker);
|
|
1995
2579
|
taskWorker_class_private_method_init(this, _startProcess);
|
|
1996
|
-
taskWorker_class_private_method_init(this, _inflightCount);
|
|
1997
|
-
taskWorker_class_private_method_init(this, _firstInflight);
|
|
1998
|
-
taskWorker_class_private_method_init(this, _shiftInflight);
|
|
1999
2580
|
taskWorker_class_private_method_init(this, _pumpQueue);
|
|
2000
|
-
taskWorker_class_private_method_init(this,
|
|
2001
|
-
taskWorker_class_private_method_init(this, _scheduleFinalizeCheck);
|
|
2581
|
+
taskWorker_class_private_method_init(this, _afterSentinel);
|
|
2002
2582
|
taskWorker_class_private_method_init(this, _handleStderrChunk);
|
|
2003
|
-
taskWorker_class_private_method_init(this, _scheduleSweep);
|
|
2004
|
-
taskWorker_class_private_method_init(this, _handleTaskTimeout);
|
|
2005
2583
|
taskWorker_class_private_method_init(this, _settleTask);
|
|
2006
2584
|
taskWorker_class_private_method_init(this, _rejectAll);
|
|
2007
2585
|
taskWorker_class_private_field_init(this, _processManager, {
|
|
@@ -2012,22 +2590,14 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2012
2590
|
writable: true,
|
|
2013
2591
|
value: new queue_Queue()
|
|
2014
2592
|
});
|
|
2015
|
-
taskWorker_class_private_field_init(this,
|
|
2016
|
-
writable: true,
|
|
2017
|
-
value: []
|
|
2018
|
-
});
|
|
2019
|
-
taskWorker_class_private_field_init(this, _inflightHead, {
|
|
2593
|
+
taskWorker_class_private_field_init(this, taskWorker_inflight, {
|
|
2020
2594
|
writable: true,
|
|
2021
|
-
value:
|
|
2595
|
+
value: new inflightTracker_InflightTracker()
|
|
2022
2596
|
});
|
|
2023
2597
|
taskWorker_class_private_field_init(this, _pendingFinalizeTasks, {
|
|
2024
2598
|
writable: true,
|
|
2025
2599
|
value: new Set()
|
|
2026
2600
|
});
|
|
2027
|
-
taskWorker_class_private_field_init(this, _scheduledFinalize, {
|
|
2028
|
-
writable: true,
|
|
2029
|
-
value: false
|
|
2030
|
-
});
|
|
2031
2601
|
taskWorker_class_private_field_init(this, _valueParser, {
|
|
2032
2602
|
writable: true,
|
|
2033
2603
|
value: void 0
|
|
@@ -2056,31 +2626,72 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2056
2626
|
writable: true,
|
|
2057
2627
|
value: void 0
|
|
2058
2628
|
});
|
|
2059
|
-
taskWorker_class_private_field_init(this,
|
|
2629
|
+
taskWorker_class_private_field_init(this, _sweeper, {
|
|
2060
2630
|
writable: true,
|
|
2061
|
-
value:
|
|
2631
|
+
value: void 0
|
|
2632
|
+
});
|
|
2633
|
+
taskWorker_class_private_field_init(this, _scheduleFinalizeCheck, {
|
|
2634
|
+
writable: true,
|
|
2635
|
+
value: void 0
|
|
2062
2636
|
});
|
|
2063
|
-
taskWorker_class_private_field_init(this,
|
|
2637
|
+
taskWorker_class_private_field_init(this, _pump, {
|
|
2064
2638
|
writable: true,
|
|
2065
2639
|
value: void 0
|
|
2066
2640
|
});
|
|
2641
|
+
taskWorker_class_private_field_init(this, _pendingStderr, {
|
|
2642
|
+
writable: true,
|
|
2643
|
+
value: []
|
|
2644
|
+
});
|
|
2067
2645
|
taskWorker_class_private_field_set(this, _name, null != name ? name : "worker");
|
|
2068
2646
|
taskWorker_class_private_field_set(this, _statementTimeout, statementTimeout);
|
|
2069
2647
|
taskWorker_class_private_field_set(this, _logger, logger);
|
|
2070
2648
|
taskWorker_class_private_field_set(this, _batchSize, batchSize);
|
|
2071
2649
|
taskWorker_class_private_field_set(this, _maxInflight, maxInflight);
|
|
2072
2650
|
taskWorker_class_private_field_set(this, _metrics, metrics);
|
|
2073
|
-
taskWorker_class_private_field_set(this, _sweepIntervalMs, sweepInterval);
|
|
2074
2651
|
taskWorker_class_private_field_set(this, _processManager, new process_ProcessManager({
|
|
2075
2652
|
binary: binary,
|
|
2076
2653
|
database: database,
|
|
2077
|
-
initMode: initMode
|
|
2078
|
-
|
|
2079
|
-
|
|
2654
|
+
initMode: initMode
|
|
2655
|
+
}));
|
|
2656
|
+
taskWorker_class_private_field_get(this, _processManager).setOnDrainCallback(function() {
|
|
2657
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2658
|
+
});
|
|
2659
|
+
taskWorker_class_private_field_set(this, _sweeper, createSweeper({
|
|
2660
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2661
|
+
sweepIntervalMs: sweepInterval,
|
|
2662
|
+
handleTaskTimeout: function(task) {
|
|
2663
|
+
var error = prepareTaskTimeout(task, taskWorker_class_private_field_get(_this, _metrics));
|
|
2664
|
+
if (error) taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, error, void 0);
|
|
2080
2665
|
}
|
|
2081
2666
|
}));
|
|
2667
|
+
taskWorker_class_private_field_set(this, _pump, createPumpQueue({
|
|
2668
|
+
queue: taskWorker_class_private_field_get(this, _pendingQueue),
|
|
2669
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2670
|
+
processManager: taskWorker_class_private_field_get(this, _processManager),
|
|
2671
|
+
sweeper: taskWorker_class_private_field_get(this, _sweeper),
|
|
2672
|
+
batchSize: taskWorker_class_private_field_get(this, _batchSize),
|
|
2673
|
+
maxInflight: taskWorker_class_private_field_get(this, _maxInflight)
|
|
2674
|
+
}));
|
|
2675
|
+
taskWorker_class_private_field_set(this, _scheduleFinalizeCheck, createFinalizeScheduler({
|
|
2676
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2677
|
+
settleTask: function(t, e, v1) {
|
|
2678
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2679
|
+
},
|
|
2680
|
+
pumpQueue: function() {
|
|
2681
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2682
|
+
},
|
|
2683
|
+
pendingStderr: taskWorker_class_private_field_get(this, _pendingStderr),
|
|
2684
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight)
|
|
2685
|
+
}));
|
|
2082
2686
|
taskWorker_class_private_field_set(this, _valueParser, createJsonValueParser(function(raw) {
|
|
2083
|
-
|
|
2687
|
+
handleParsedValue(raw, taskWorker_class_private_field_get(_this, taskWorker_inflight), {
|
|
2688
|
+
afterSentinel: function(task) {
|
|
2689
|
+
return taskWorker_class_private_method_get(_this, _afterSentinel, taskWorker_afterSentinel).call(_this, task);
|
|
2690
|
+
},
|
|
2691
|
+
rejectAll: function(error) {
|
|
2692
|
+
return taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, error);
|
|
2693
|
+
}
|
|
2694
|
+
});
|
|
2084
2695
|
}));
|
|
2085
2696
|
taskWorker_class_private_method_get(this, _startProcess, startProcess).call(this);
|
|
2086
2697
|
}
|
|
@@ -2094,13 +2705,13 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2094
2705
|
{
|
|
2095
2706
|
key: "idle",
|
|
2096
2707
|
get: function() {
|
|
2097
|
-
return
|
|
2708
|
+
return 0 === taskWorker_class_private_field_get(this, taskWorker_inflight).count && taskWorker_class_private_field_get(this, _pendingQueue).isEmpty() && 0 === taskWorker_class_private_field_get(this, _pendingFinalizeTasks).size;
|
|
2098
2709
|
}
|
|
2099
2710
|
},
|
|
2100
2711
|
{
|
|
2101
2712
|
key: "pendingStatements",
|
|
2102
2713
|
get: function() {
|
|
2103
|
-
return taskWorker_class_private_field_get(this, _pendingQueue).size +
|
|
2714
|
+
return taskWorker_class_private_field_get(this, _pendingQueue).size + taskWorker_class_private_field_get(this, taskWorker_inflight).count + taskWorker_class_private_field_get(this, _pendingFinalizeTasks).size;
|
|
2104
2715
|
}
|
|
2105
2716
|
},
|
|
2106
2717
|
{
|
|
@@ -2130,7 +2741,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2130
2741
|
{
|
|
2131
2742
|
key: "_sweepTimer",
|
|
2132
2743
|
get: function() {
|
|
2133
|
-
|
|
2744
|
+
var _$_class_private_field_get;
|
|
2745
|
+
var _class_private_field_get_getSweepTimer;
|
|
2746
|
+
return null != (_class_private_field_get_getSweepTimer = null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _sweeper)) ? void 0 : _$_class_private_field_get.getSweepTimer()) ? _class_private_field_get_getSweepTimer : null;
|
|
2134
2747
|
}
|
|
2135
2748
|
},
|
|
2136
2749
|
{
|
|
@@ -2142,8 +2755,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2142
2755
|
{
|
|
2143
2756
|
key: "kill",
|
|
2144
2757
|
value: function() {
|
|
2145
|
-
|
|
2146
|
-
|
|
2758
|
+
var _class_private_field_get_cancel, _$_class_private_field_get;
|
|
2759
|
+
taskWorker_class_private_field_get(this, _sweeper).clear();
|
|
2760
|
+
null == (_class_private_field_get_cancel = (_$_class_private_field_get = taskWorker_class_private_field_get(this, _scheduleFinalizeCheck)).cancel) || _class_private_field_get_cancel.call(_$_class_private_field_get);
|
|
2147
2761
|
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, new Error("".concat(taskWorker_class_private_field_get(this, _name), " is killed")));
|
|
2148
2762
|
taskWorker_class_private_field_get(this, _processManager).kill();
|
|
2149
2763
|
}
|
|
@@ -2158,7 +2772,7 @@ function startProcess() {
|
|
|
2158
2772
|
taskWorker_class_private_field_get(_this, _valueParser).feed(chunk);
|
|
2159
2773
|
});
|
|
2160
2774
|
proc.stderr.on("data", function(chunk) {
|
|
2161
|
-
taskWorker_class_private_method_get(_this, _handleStderrChunk,
|
|
2775
|
+
taskWorker_class_private_method_get(_this, _handleStderrChunk, taskWorker_handleStderrChunk1).call(_this, chunk);
|
|
2162
2776
|
});
|
|
2163
2777
|
proc.on("error", function(error) {
|
|
2164
2778
|
var _class_private_field_get_error, _$_class_private_field_get;
|
|
@@ -2172,200 +2786,47 @@ function startProcess() {
|
|
|
2172
2786
|
taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, err);
|
|
2173
2787
|
});
|
|
2174
2788
|
}
|
|
2175
|
-
function inflightCount() {
|
|
2176
|
-
return taskWorker_class_private_field_get(this, _inflightTasks).length - taskWorker_class_private_field_get(this, _inflightHead);
|
|
2177
|
-
}
|
|
2178
|
-
function firstInflight() {
|
|
2179
|
-
return taskWorker_class_private_field_get(this, _inflightHead) < taskWorker_class_private_field_get(this, _inflightTasks).length ? taskWorker_class_private_field_get(this, _inflightTasks)[taskWorker_class_private_field_get(this, _inflightHead)] : null;
|
|
2180
|
-
}
|
|
2181
|
-
function shiftInflight() {
|
|
2182
|
-
var task = taskWorker_class_private_field_get(this, _inflightTasks)[taskWorker_class_private_field_get(this, _inflightHead)];
|
|
2183
|
-
taskWorker_class_private_field_get(this, _inflightTasks)[taskWorker_class_private_field_get(this, _inflightHead)] = null;
|
|
2184
|
-
taskWorker_class_private_field_update(this, _inflightHead).value++;
|
|
2185
|
-
if (taskWorker_class_private_field_get(this, _inflightHead) >= taskWorker_class_private_field_get(this, _inflightTasks).length) {
|
|
2186
|
-
taskWorker_class_private_field_set(this, _inflightTasks, []);
|
|
2187
|
-
taskWorker_class_private_field_set(this, _inflightHead, 0);
|
|
2188
|
-
} else if (taskWorker_class_private_field_get(this, _inflightHead) > 128) {
|
|
2189
|
-
taskWorker_class_private_field_set(this, _inflightTasks, taskWorker_class_private_field_get(this, _inflightTasks).slice(taskWorker_class_private_field_get(this, _inflightHead)));
|
|
2190
|
-
taskWorker_class_private_field_set(this, _inflightHead, 0);
|
|
2191
|
-
}
|
|
2192
|
-
return task;
|
|
2193
|
-
}
|
|
2194
2789
|
function taskWorker_pumpQueue() {
|
|
2195
|
-
|
|
2196
|
-
if (taskWorker_class_private_field_get(this, _processManager).draining) return;
|
|
2197
|
-
if (taskWorker_class_private_method_get(this, _inflightCount, inflightCount).call(this) >= taskWorker_class_private_field_get(this, _maxInflight)) return;
|
|
2198
|
-
var batch = [];
|
|
2199
|
-
while(batch.length < taskWorker_class_private_field_get(this, _batchSize) && !taskWorker_class_private_field_get(this, _pendingQueue).isEmpty() && taskWorker_class_private_method_get(this, _inflightCount, inflightCount).call(this) + batch.length < taskWorker_class_private_field_get(this, _maxInflight)){
|
|
2200
|
-
var task = taskWorker_class_private_field_get(this, _pendingQueue).peek();
|
|
2201
|
-
if ("stream" === task.kind && (batch.length > 0 || taskWorker_class_private_method_get(this, _inflightCount, inflightCount).call(this) > 0)) break;
|
|
2202
|
-
taskWorker_class_private_field_get(this, _pendingQueue).dequeue();
|
|
2203
|
-
batch.push(task);
|
|
2204
|
-
}
|
|
2205
|
-
if (0 === batch.length) return;
|
|
2206
|
-
var now = performance.now();
|
|
2207
|
-
var payload = buildBatchPayload(batch);
|
|
2208
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2209
|
-
try {
|
|
2210
|
-
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2211
|
-
var task1 = _step.value;
|
|
2212
|
-
task1.startTime = now;
|
|
2213
|
-
}
|
|
2214
|
-
} catch (err) {
|
|
2215
|
-
_didIteratorError = true;
|
|
2216
|
-
_iteratorError = err;
|
|
2217
|
-
} finally{
|
|
2218
|
-
try {
|
|
2219
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2220
|
-
} finally{
|
|
2221
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
(_$_class_private_field_get = taskWorker_class_private_field_get(this, _inflightTasks)).push.apply(_$_class_private_field_get, _to_consumable_array(batch));
|
|
2225
|
-
taskWorker_class_private_method_get(this, _scheduleSweep, scheduleSweep).call(this);
|
|
2226
|
-
taskWorker_class_private_field_get(this, _processManager).write(payload);
|
|
2227
|
-
}
|
|
2228
|
-
function handleParsedValue(raw) {
|
|
2229
|
-
var task = taskWorker_class_private_method_get(this, _firstInflight, firstInflight).call(this);
|
|
2230
|
-
if (!task) return;
|
|
2231
|
-
if (isSentinelRaw(raw, task.token)) {
|
|
2232
|
-
taskWorker_class_private_method_get(this, _shiftInflight, shiftInflight).call(this);
|
|
2233
|
-
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2234
|
-
if (task.stderrText) {
|
|
2235
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2236
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2237
|
-
return;
|
|
2238
|
-
}
|
|
2239
|
-
if (task.consumerError) {
|
|
2240
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2241
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2242
|
-
return;
|
|
2243
|
-
}
|
|
2244
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2245
|
-
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2246
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2247
|
-
return;
|
|
2248
|
-
}
|
|
2249
|
-
if ("[]" === raw) return;
|
|
2250
|
-
var parsed;
|
|
2251
|
-
try {
|
|
2252
|
-
parsed = JSON.parse(raw);
|
|
2253
|
-
} catch (error) {
|
|
2254
|
-
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
if (isSentinelRow(parsed, task.token)) {
|
|
2258
|
-
taskWorker_class_private_method_get(this, _shiftInflight, shiftInflight).call(this);
|
|
2259
|
-
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2260
|
-
if (task.stderrText) {
|
|
2261
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2262
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
if (task.consumerError) {
|
|
2266
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2267
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2268
|
-
return;
|
|
2269
|
-
}
|
|
2270
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2271
|
-
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2272
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2273
|
-
return;
|
|
2274
|
-
}
|
|
2275
|
-
if (task.timedout) return;
|
|
2276
|
-
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
2277
|
-
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
2790
|
+
taskWorker_class_private_field_get(this, _pump).call(this);
|
|
2278
2791
|
}
|
|
2279
|
-
function
|
|
2792
|
+
function taskWorker_afterSentinel(task) {
|
|
2280
2793
|
var _this = this;
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
setImmediate(function() {
|
|
2284
|
-
taskWorker_class_private_field_set(_this, _scheduledFinalize, false);
|
|
2285
|
-
finalizePendingTasks(taskWorker_class_private_field_get(_this, _pendingFinalizeTasks), function(t, e, v1) {
|
|
2794
|
+
handleSentinelTask(task, {
|
|
2795
|
+
settleTask: function(t, e, v1) {
|
|
2286
2796
|
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2287
|
-
},
|
|
2797
|
+
},
|
|
2798
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2799
|
+
scheduleFinalizeCheck: function() {
|
|
2800
|
+
return taskWorker_class_private_field_get(_this, _scheduleFinalizeCheck).call(_this);
|
|
2801
|
+
},
|
|
2802
|
+
pumpQueue: function() {
|
|
2288
2803
|
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2289
|
-
});
|
|
2290
|
-
});
|
|
2291
|
-
}
|
|
2292
|
-
function taskWorker_handleStderrChunk(chunk) {
|
|
2293
|
-
var _class_private_field_get_values_next_value;
|
|
2294
|
-
var task = null != (_class_private_field_get_values_next_value = taskWorker_class_private_field_get(this, _pendingFinalizeTasks).values().next().value) ? _class_private_field_get_values_next_value : taskWorker_class_private_method_get(this, _firstInflight, firstInflight).call(this);
|
|
2295
|
-
if (!task) {
|
|
2296
|
-
var _class_private_field_get_error, _$_class_private_field_get;
|
|
2297
|
-
null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _logger)) || null == (_class_private_field_get_error = _$_class_private_field_get.error) || _class_private_field_get_error.call(_$_class_private_field_get, chunk.trim());
|
|
2298
|
-
return;
|
|
2299
|
-
}
|
|
2300
|
-
task.stderrText += chunk;
|
|
2301
|
-
}
|
|
2302
|
-
function scheduleSweep() {
|
|
2303
|
-
var _this = this;
|
|
2304
|
-
if (taskWorker_class_private_field_get(this, _sweepTimer)) return;
|
|
2305
|
-
taskWorker_class_private_field_set(this, _sweepTimer, setTimeout(function() {
|
|
2306
|
-
taskWorker_class_private_field_set(_this, _sweepTimer, null);
|
|
2307
|
-
var tasks = taskWorker_class_private_field_get(_this, _inflightTasks);
|
|
2308
|
-
var head = taskWorker_class_private_field_get(_this, _inflightHead);
|
|
2309
|
-
var now = performance.now();
|
|
2310
|
-
for(var i = head; i < tasks.length; i++){
|
|
2311
|
-
var task = tasks[i];
|
|
2312
|
-
if (now - task.startTime > task.timeout) taskWorker_class_private_method_get(_this, _handleTaskTimeout, handleTaskTimeout).call(_this, task);
|
|
2313
2804
|
}
|
|
2314
|
-
|
|
2315
|
-
}, taskWorker_class_private_field_get(this, _sweepIntervalMs)).unref());
|
|
2805
|
+
});
|
|
2316
2806
|
}
|
|
2317
|
-
function
|
|
2318
|
-
|
|
2319
|
-
|
|
2807
|
+
function taskWorker_handleStderrChunk1(chunk) {
|
|
2808
|
+
handleStderrChunk(chunk, {
|
|
2809
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2810
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2811
|
+
logger: taskWorker_class_private_field_get(this, _logger),
|
|
2812
|
+
pendingStderr: taskWorker_class_private_field_get(this, _pendingStderr)
|
|
2813
|
+
});
|
|
2320
2814
|
}
|
|
2321
2815
|
function settleTask1(task, error, value) {
|
|
2322
|
-
|
|
2816
|
+
settleUtils_settleTask(task, error, value, taskWorker_class_private_field_get(this, _metrics));
|
|
2323
2817
|
}
|
|
2324
2818
|
function taskWorker_rejectAll(error) {
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
}
|
|
2336
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2337
|
-
try {
|
|
2338
|
-
for(var _iterator = all[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2339
|
-
var task = _step.value;
|
|
2340
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, error, void 0);
|
|
2341
|
-
}
|
|
2342
|
-
} catch (err) {
|
|
2343
|
-
_didIteratorError = true;
|
|
2344
|
-
_iteratorError = err;
|
|
2345
|
-
} finally{
|
|
2346
|
-
try {
|
|
2347
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2348
|
-
} finally{
|
|
2349
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2353
|
-
try {
|
|
2354
|
-
for(var _iterator1 = taskWorker_class_private_field_get(this, _pendingFinalizeTasks)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2355
|
-
var task1 = _step1.value;
|
|
2356
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task1, error, void 0);
|
|
2357
|
-
}
|
|
2358
|
-
} catch (err) {
|
|
2359
|
-
_didIteratorError1 = true;
|
|
2360
|
-
_iteratorError1 = err;
|
|
2361
|
-
} finally{
|
|
2362
|
-
try {
|
|
2363
|
-
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2364
|
-
} finally{
|
|
2365
|
-
if (_didIteratorError1) throw _iteratorError1;
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).clear();
|
|
2819
|
+
var _this = this;
|
|
2820
|
+
taskWorker_class_private_field_get(this, _sweeper).clear();
|
|
2821
|
+
rejectAllTasks({
|
|
2822
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2823
|
+
queue: taskWorker_class_private_field_get(this, _pendingQueue),
|
|
2824
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2825
|
+
settleTask: function(t, e, v1) {
|
|
2826
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2827
|
+
},
|
|
2828
|
+
error: error
|
|
2829
|
+
});
|
|
2369
2830
|
}
|
|
2370
2831
|
function readerPool_check_private_redeclaration(obj, privateCollection) {
|
|
2371
2832
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -2438,7 +2899,7 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2438
2899
|
logger: logger,
|
|
2439
2900
|
metrics: metrics,
|
|
2440
2901
|
name: "reader-".concat(i),
|
|
2441
|
-
initMode: ":memory:" !== database ? "none" : "
|
|
2902
|
+
initMode: ":memory:" !== database ? "none" : "none"
|
|
2442
2903
|
});
|
|
2443
2904
|
readerPool_class_private_field_get(this, _workers).push(worker);
|
|
2444
2905
|
}
|
|
@@ -2719,6 +3180,10 @@ var metrics_Metrics = /*#__PURE__*/ function() {
|
|
|
2719
3180
|
key: "snapshot",
|
|
2720
3181
|
value: function() {
|
|
2721
3182
|
var elapsed = (Date.now() - metrics_class_private_field_get(this, _startTime)) / 1000;
|
|
3183
|
+
var avgTaskDuration;
|
|
3184
|
+
avgTaskDuration = metrics_class_private_field_get(this, _tasksSuccess) > 0 ? metrics_class_private_field_get(this, _totalDuration) / metrics_class_private_field_get(this, _tasksSuccess) : 0;
|
|
3185
|
+
var throughput;
|
|
3186
|
+
throughput = elapsed > 0 ? metrics_class_private_field_get(this, _tasksTotal) / elapsed : 0;
|
|
2722
3187
|
return {
|
|
2723
3188
|
tasksTotal: metrics_class_private_field_get(this, _tasksTotal),
|
|
2724
3189
|
tasksSuccess: metrics_class_private_field_get(this, _tasksSuccess),
|
|
@@ -2728,8 +3193,8 @@ var metrics_Metrics = /*#__PURE__*/ function() {
|
|
|
2728
3193
|
executeCount: metrics_class_private_field_get(this, _executeCount),
|
|
2729
3194
|
queryCount: metrics_class_private_field_get(this, _queryCount),
|
|
2730
3195
|
streamCount: metrics_class_private_field_get(this, _streamCount),
|
|
2731
|
-
|
|
2732
|
-
|
|
3196
|
+
avgTaskDuration: avgTaskDuration,
|
|
3197
|
+
throughput: throughput,
|
|
2733
3198
|
uptime: elapsed
|
|
2734
3199
|
};
|
|
2735
3200
|
}
|
|
@@ -3003,7 +3468,7 @@ var transactionScope_TransactionScope = /*#__PURE__*/ function() {
|
|
|
3003
3468
|
value: function(error) {
|
|
3004
3469
|
var task = transactionScope_class_private_field_get(this, _deferredQueue).dequeue();
|
|
3005
3470
|
while(task){
|
|
3006
|
-
|
|
3471
|
+
settleUtils_settleTask(task, error, void 0, null);
|
|
3007
3472
|
task = transactionScope_class_private_field_get(this, _deferredQueue).dequeue();
|
|
3008
3473
|
}
|
|
3009
3474
|
}
|
|
@@ -3011,14 +3476,6 @@ var transactionScope_TransactionScope = /*#__PURE__*/ function() {
|
|
|
3011
3476
|
]);
|
|
3012
3477
|
return TransactionScope;
|
|
3013
3478
|
}();
|
|
3014
|
-
function pipelineEngine_array_like_to_array(arr, len) {
|
|
3015
|
-
if (null == len || len > arr.length) len = arr.length;
|
|
3016
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3017
|
-
return arr2;
|
|
3018
|
-
}
|
|
3019
|
-
function pipelineEngine_array_without_holes(arr) {
|
|
3020
|
-
if (Array.isArray(arr)) return pipelineEngine_array_like_to_array(arr);
|
|
3021
|
-
}
|
|
3022
3479
|
function pipelineEngine_check_private_redeclaration(obj, privateCollection) {
|
|
3023
3480
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3024
3481
|
}
|
|
@@ -3033,22 +3490,6 @@ function pipelineEngine_class_apply_descriptor_set(receiver, descriptor, value)
|
|
|
3033
3490
|
descriptor.value = value;
|
|
3034
3491
|
}
|
|
3035
3492
|
}
|
|
3036
|
-
function pipelineEngine_class_apply_descriptor_update(receiver, descriptor) {
|
|
3037
|
-
if (descriptor.set) {
|
|
3038
|
-
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
3039
|
-
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
3040
|
-
set value (v){
|
|
3041
|
-
descriptor.set.call(receiver, v);
|
|
3042
|
-
},
|
|
3043
|
-
get value () {
|
|
3044
|
-
return descriptor.get.call(receiver);
|
|
3045
|
-
}
|
|
3046
|
-
};
|
|
3047
|
-
return descriptor.__destrWrapper;
|
|
3048
|
-
}
|
|
3049
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
3050
|
-
return descriptor;
|
|
3051
|
-
}
|
|
3052
3493
|
function pipelineEngine_class_call_check(instance, Constructor) {
|
|
3053
3494
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3054
3495
|
}
|
|
@@ -3069,10 +3510,6 @@ function pipelineEngine_class_private_field_set(receiver, privateMap, value) {
|
|
|
3069
3510
|
pipelineEngine_class_apply_descriptor_set(receiver, descriptor, value);
|
|
3070
3511
|
return value;
|
|
3071
3512
|
}
|
|
3072
|
-
function pipelineEngine_class_private_field_update(receiver, privateMap) {
|
|
3073
|
-
var descriptor = pipelineEngine_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
3074
|
-
return pipelineEngine_class_apply_descriptor_update(receiver, descriptor);
|
|
3075
|
-
}
|
|
3076
3513
|
function pipelineEngine_class_private_method_get(receiver, privateSet, fn) {
|
|
3077
3514
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
3078
3515
|
return fn;
|
|
@@ -3095,59 +3532,29 @@ function pipelineEngine_create_class(Constructor, protoProps, staticProps) {
|
|
|
3095
3532
|
if (staticProps) pipelineEngine_defineProperties(Constructor, staticProps);
|
|
3096
3533
|
return Constructor;
|
|
3097
3534
|
}
|
|
3098
|
-
|
|
3099
|
-
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
3100
|
-
}
|
|
3101
|
-
function pipelineEngine_non_iterable_spread() {
|
|
3102
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3103
|
-
}
|
|
3104
|
-
function pipelineEngine_to_consumable_array(arr) {
|
|
3105
|
-
return pipelineEngine_array_without_holes(arr) || pipelineEngine_iterable_to_array(arr) || pipelineEngine_unsupported_iterable_to_array(arr) || pipelineEngine_non_iterable_spread();
|
|
3106
|
-
}
|
|
3107
|
-
function pipelineEngine_unsupported_iterable_to_array(o, minLen) {
|
|
3108
|
-
if (!o) return;
|
|
3109
|
-
if ("string" == typeof o) return pipelineEngine_array_like_to_array(o, minLen);
|
|
3110
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3111
|
-
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
3112
|
-
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
3113
|
-
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineEngine_array_like_to_array(o, minLen);
|
|
3114
|
-
}
|
|
3115
|
-
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightHead = /*#__PURE__*/ new WeakMap(), pipelineEngine_pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_scheduledFinalize = /*#__PURE__*/ new WeakMap(), _sharedValueParser = /*#__PURE__*/ new WeakMap(), pipelineEngine_processManager = /*#__PURE__*/ new WeakMap(), pipelineEngine_metrics = /*#__PURE__*/ new WeakMap(), pipelineEngine_statementTimeout = /*#__PURE__*/ new WeakMap(), pipelineEngine_logger = /*#__PURE__*/ new WeakMap(), pipelineEngine_batchSize = /*#__PURE__*/ new WeakMap(), pipelineEngine_maxInflight = /*#__PURE__*/ new WeakMap(), _onTaskTimeout = /*#__PURE__*/ new WeakMap(), _active = /*#__PURE__*/ new WeakMap(), pipelineEngine_sweepTimer = /*#__PURE__*/ new WeakMap(), pipelineEngine_sweepIntervalMs = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightCount = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_firstInflight = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_shiftInflight = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), pipelineEngine_handleParsedValue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), pipelineEngine_scheduleSweep = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_handleTaskTimeout = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
3535
|
+
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflight = /*#__PURE__*/ new WeakMap(), pipelineEngine_pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), _sharedValueParser = /*#__PURE__*/ new WeakMap(), pipelineEngine_processManager = /*#__PURE__*/ new WeakMap(), pipelineEngine_metrics = /*#__PURE__*/ new WeakMap(), pipelineEngine_statementTimeout = /*#__PURE__*/ new WeakMap(), pipelineEngine_logger = /*#__PURE__*/ new WeakMap(), pipelineEngine_batchSize = /*#__PURE__*/ new WeakMap(), pipelineEngine_maxInflight = /*#__PURE__*/ new WeakMap(), _onTaskTimeout = /*#__PURE__*/ new WeakMap(), _active = /*#__PURE__*/ new WeakMap(), pipelineEngine_sweeper = /*#__PURE__*/ new WeakMap(), pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakMap(), pipelineEngine_pump = /*#__PURE__*/ new WeakMap(), pipelineEngine_pendingStderr = /*#__PURE__*/ new WeakMap(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_afterSentinel = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
3116
3536
|
var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
3117
3537
|
"use strict";
|
|
3118
3538
|
function PipelineEngine(processManager, param) {
|
|
3119
3539
|
var _this = this;
|
|
3120
3540
|
var metrics = param.metrics, statementTimeout = param.statementTimeout, logger = param.logger, _param_batchSize = param.batchSize, batchSize = void 0 === _param_batchSize ? DEFAULT_BATCH_SIZE : _param_batchSize, _param_maxInflight = param.maxInflight, maxInflight = void 0 === _param_maxInflight ? DEFAULT_MAX_INFLIGHT : _param_maxInflight, onTaskTimeout = param.onTaskTimeout, _param_sweepInterval = param.sweepInterval, sweepInterval = void 0 === _param_sweepInterval ? 100 : _param_sweepInterval;
|
|
3121
3541
|
pipelineEngine_class_call_check(this, PipelineEngine);
|
|
3122
|
-
|
|
3123
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_firstInflight);
|
|
3124
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_shiftInflight);
|
|
3542
|
+
var _this1, _this2;
|
|
3125
3543
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_pumpQueue);
|
|
3126
|
-
pipelineEngine_class_private_method_init(this,
|
|
3127
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_scheduleFinalizeCheck);
|
|
3128
|
-
pipelineEngine_class_private_method_init(this, pipelineEngine_scheduleSweep);
|
|
3129
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_handleTaskTimeout);
|
|
3544
|
+
pipelineEngine_class_private_method_init(this, core_pipelineEngine_afterSentinel);
|
|
3130
3545
|
pipelineEngine_class_private_method_init(this, pipelineEngine_settleTask);
|
|
3131
3546
|
pipelineEngine_class_private_field_init(this, _queue, {
|
|
3132
3547
|
writable: true,
|
|
3133
3548
|
value: new queue_Queue()
|
|
3134
3549
|
});
|
|
3135
|
-
pipelineEngine_class_private_field_init(this,
|
|
3136
|
-
writable: true,
|
|
3137
|
-
value: []
|
|
3138
|
-
});
|
|
3139
|
-
pipelineEngine_class_private_field_init(this, pipelineEngine_inflightHead, {
|
|
3550
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_inflight, {
|
|
3140
3551
|
writable: true,
|
|
3141
|
-
value:
|
|
3552
|
+
value: new inflightTracker_InflightTracker()
|
|
3142
3553
|
});
|
|
3143
3554
|
pipelineEngine_class_private_field_init(this, pipelineEngine_pendingFinalizeTasks, {
|
|
3144
3555
|
writable: true,
|
|
3145
3556
|
value: new Set()
|
|
3146
3557
|
});
|
|
3147
|
-
pipelineEngine_class_private_field_init(this, pipelineEngine_scheduledFinalize, {
|
|
3148
|
-
writable: true,
|
|
3149
|
-
value: false
|
|
3150
|
-
});
|
|
3151
3558
|
pipelineEngine_class_private_field_init(this, _sharedValueParser, {
|
|
3152
3559
|
writable: true,
|
|
3153
3560
|
value: void 0
|
|
@@ -3184,14 +3591,22 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3184
3591
|
writable: true,
|
|
3185
3592
|
value: false
|
|
3186
3593
|
});
|
|
3187
|
-
pipelineEngine_class_private_field_init(this,
|
|
3594
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_sweeper, {
|
|
3188
3595
|
writable: true,
|
|
3189
|
-
value:
|
|
3596
|
+
value: void 0
|
|
3190
3597
|
});
|
|
3191
|
-
pipelineEngine_class_private_field_init(this,
|
|
3598
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_scheduleFinalizeCheck, {
|
|
3192
3599
|
writable: true,
|
|
3193
3600
|
value: void 0
|
|
3194
3601
|
});
|
|
3602
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_pump, {
|
|
3603
|
+
writable: true,
|
|
3604
|
+
value: void 0
|
|
3605
|
+
});
|
|
3606
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_pendingStderr, {
|
|
3607
|
+
writable: true,
|
|
3608
|
+
value: []
|
|
3609
|
+
});
|
|
3195
3610
|
pipelineEngine_class_private_field_set(this, pipelineEngine_processManager, processManager);
|
|
3196
3611
|
pipelineEngine_class_private_field_set(this, pipelineEngine_metrics, metrics);
|
|
3197
3612
|
pipelineEngine_class_private_field_set(this, pipelineEngine_statementTimeout, statementTimeout);
|
|
@@ -3199,19 +3614,57 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3199
3614
|
pipelineEngine_class_private_field_set(this, pipelineEngine_batchSize, batchSize);
|
|
3200
3615
|
pipelineEngine_class_private_field_set(this, pipelineEngine_maxInflight, maxInflight);
|
|
3201
3616
|
pipelineEngine_class_private_field_set(this, _onTaskTimeout, null != onTaskTimeout ? onTaskTimeout : function() {});
|
|
3617
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_sweeper, createSweeper({
|
|
3618
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3619
|
+
sweepIntervalMs: sweepInterval,
|
|
3620
|
+
handleTaskTimeout: function(task) {
|
|
3621
|
+
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(_this, pipelineEngine_metrics));
|
|
3622
|
+
if (error) {
|
|
3623
|
+
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, error, void 0);
|
|
3624
|
+
null == (_this1 = pipelineEngine_class_private_field_get(_this2 = _this, _onTaskTimeout)) || _this1.call(_this2, task);
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
}));
|
|
3628
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_pump, createPumpQueue({
|
|
3629
|
+
queue: pipelineEngine_class_private_field_get(this, _queue),
|
|
3630
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3631
|
+
processManager: pipelineEngine_class_private_field_get(this, pipelineEngine_processManager),
|
|
3632
|
+
sweeper: pipelineEngine_class_private_field_get(this, pipelineEngine_sweeper),
|
|
3633
|
+
batchSize: pipelineEngine_class_private_field_get(this, pipelineEngine_batchSize),
|
|
3634
|
+
maxInflight: pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)
|
|
3635
|
+
}));
|
|
3636
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_scheduleFinalizeCheck, createFinalizeScheduler({
|
|
3637
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3638
|
+
settleTask: function(t, e, v1) {
|
|
3639
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3640
|
+
},
|
|
3641
|
+
pumpQueue: function() {
|
|
3642
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3643
|
+
},
|
|
3644
|
+
pendingStderr: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingStderr),
|
|
3645
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight)
|
|
3646
|
+
}));
|
|
3202
3647
|
pipelineEngine_class_private_field_set(this, _sharedValueParser, createJsonValueParser(function(raw) {
|
|
3203
|
-
|
|
3648
|
+
handleParsedValue(raw, pipelineEngine_class_private_field_get(_this, pipelineEngine_inflight), {
|
|
3649
|
+
afterSentinel: function(task) {
|
|
3650
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_afterSentinel, pipelineEngine_afterSentinel).call(_this, task);
|
|
3651
|
+
},
|
|
3652
|
+
rejectAll: function(error) {
|
|
3653
|
+
return _this.rejectAll(error);
|
|
3654
|
+
}
|
|
3655
|
+
});
|
|
3204
3656
|
}));
|
|
3205
3657
|
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).setOnDrainCallback(function() {
|
|
3206
3658
|
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3207
3659
|
});
|
|
3208
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_sweepIntervalMs, sweepInterval);
|
|
3209
3660
|
}
|
|
3210
3661
|
pipelineEngine_create_class(PipelineEngine, [
|
|
3211
3662
|
{
|
|
3212
3663
|
key: "_sweepTimer",
|
|
3213
3664
|
get: function() {
|
|
3214
|
-
|
|
3665
|
+
var _$_class_private_field_get;
|
|
3666
|
+
var _class_private_field_get_getSweepTimer;
|
|
3667
|
+
return null != (_class_private_field_get_getSweepTimer = null == (_$_class_private_field_get = pipelineEngine_class_private_field_get(this, pipelineEngine_sweeper)) ? void 0 : _$_class_private_field_get.getSweepTimer()) ? _class_private_field_get_getSweepTimer : null;
|
|
3215
3668
|
}
|
|
3216
3669
|
},
|
|
3217
3670
|
{
|
|
@@ -3229,7 +3682,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3229
3682
|
{
|
|
3230
3683
|
key: "pendingStatements",
|
|
3231
3684
|
get: function() {
|
|
3232
|
-
return pipelineEngine_class_private_field_get(this, _queue).size +
|
|
3685
|
+
return pipelineEngine_class_private_field_get(this, _queue).size + pipelineEngine_class_private_field_get(this, pipelineEngine_inflight).count + pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).size;
|
|
3233
3686
|
}
|
|
3234
3687
|
},
|
|
3235
3688
|
{
|
|
@@ -3262,7 +3715,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3262
3715
|
{
|
|
3263
3716
|
key: "handleStdoutChunk",
|
|
3264
3717
|
value: function(chunk) {
|
|
3265
|
-
var task =
|
|
3718
|
+
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflight).first;
|
|
3266
3719
|
if (!task) return;
|
|
3267
3720
|
if ("stream" === task.kind && task.rowParser && !task.rowParser.finished && !task.timedout) {
|
|
3268
3721
|
var leftover = task.rowParser.feed(chunk);
|
|
@@ -3275,209 +3728,64 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3275
3728
|
{
|
|
3276
3729
|
key: "handleStderrChunk",
|
|
3277
3730
|
value: function(chunk) {
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
}
|
|
3285
|
-
task.stderrText += chunk;
|
|
3731
|
+
handleStderrChunk(chunk, {
|
|
3732
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3733
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3734
|
+
logger: pipelineEngine_class_private_field_get(this, pipelineEngine_logger),
|
|
3735
|
+
pendingStderr: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingStderr)
|
|
3736
|
+
});
|
|
3286
3737
|
}
|
|
3287
3738
|
},
|
|
3288
3739
|
{
|
|
3289
3740
|
key: "rejectAll",
|
|
3290
3741
|
value: function(error) {
|
|
3742
|
+
var _this = this;
|
|
3291
3743
|
pipelineEngine_class_private_field_get(this, _sharedValueParser).reset();
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
}
|
|
3302
|
-
} catch (err) {
|
|
3303
|
-
_didIteratorError = true;
|
|
3304
|
-
_iteratorError = err;
|
|
3305
|
-
} finally{
|
|
3306
|
-
try {
|
|
3307
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3308
|
-
} finally{
|
|
3309
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
var queued = pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3313
|
-
while(queued){
|
|
3314
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, queued, error, void 0);
|
|
3315
|
-
queued = pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3316
|
-
}
|
|
3317
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
3318
|
-
try {
|
|
3319
|
-
for(var _iterator1 = pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3320
|
-
var task1 = _step1.value;
|
|
3321
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task1, error, void 0);
|
|
3322
|
-
}
|
|
3323
|
-
} catch (err) {
|
|
3324
|
-
_didIteratorError1 = true;
|
|
3325
|
-
_iteratorError1 = err;
|
|
3326
|
-
} finally{
|
|
3327
|
-
try {
|
|
3328
|
-
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
3329
|
-
} finally{
|
|
3330
|
-
if (_didIteratorError1) throw _iteratorError1;
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).clear();
|
|
3744
|
+
rejectAllTasks({
|
|
3745
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3746
|
+
queue: pipelineEngine_class_private_field_get(this, _queue),
|
|
3747
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3748
|
+
settleTask: function(t, e, v1) {
|
|
3749
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3750
|
+
},
|
|
3751
|
+
error: error
|
|
3752
|
+
});
|
|
3334
3753
|
}
|
|
3335
3754
|
},
|
|
3336
3755
|
{
|
|
3337
3756
|
key: "kill",
|
|
3338
3757
|
value: function() {
|
|
3758
|
+
var _class_private_field_get_cancel, _$_class_private_field_get;
|
|
3339
3759
|
pipelineEngine_class_private_field_set(this, _active, false);
|
|
3340
|
-
|
|
3341
|
-
|
|
3760
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_sweeper).clear();
|
|
3761
|
+
null == (_class_private_field_get_cancel = (_$_class_private_field_get = pipelineEngine_class_private_field_get(this, pipelineEngine_scheduleFinalizeCheck)).cancel) || _class_private_field_get_cancel.call(_$_class_private_field_get);
|
|
3342
3762
|
this.rejectAll(new Error("PipelineEngine is killed"));
|
|
3343
3763
|
}
|
|
3344
3764
|
}
|
|
3345
3765
|
]);
|
|
3346
3766
|
return PipelineEngine;
|
|
3347
3767
|
}();
|
|
3348
|
-
function core_pipelineEngine_inflightCount() {
|
|
3349
|
-
return pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length - pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead);
|
|
3350
|
-
}
|
|
3351
|
-
function pipelineEngine_firstInflight() {
|
|
3352
|
-
return pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead) < pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length ? pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)] : null;
|
|
3353
|
-
}
|
|
3354
|
-
function pipelineEngine_shiftInflight() {
|
|
3355
|
-
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)];
|
|
3356
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)] = null;
|
|
3357
|
-
pipelineEngine_class_private_field_update(this, pipelineEngine_inflightHead).value++;
|
|
3358
|
-
if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead) >= pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length) {
|
|
3359
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightTasks, []);
|
|
3360
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightHead, 0);
|
|
3361
|
-
} else if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead) > 128) {
|
|
3362
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightTasks, pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).slice(pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)));
|
|
3363
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightHead, 0);
|
|
3364
|
-
}
|
|
3365
|
-
return task;
|
|
3366
|
-
}
|
|
3367
3768
|
function pipelineEngine_pumpQueue() {
|
|
3368
|
-
var _$_class_private_field_get;
|
|
3369
3769
|
if (!pipelineEngine_class_private_field_get(this, _active)) return;
|
|
3370
|
-
|
|
3371
|
-
if (pipelineEngine_class_private_method_get(this, pipelineEngine_inflightCount, core_pipelineEngine_inflightCount).call(this) >= pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)) return;
|
|
3372
|
-
var batch = [];
|
|
3373
|
-
while(batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_batchSize) && !pipelineEngine_class_private_field_get(this, _queue).isEmpty() && pipelineEngine_class_private_method_get(this, pipelineEngine_inflightCount, core_pipelineEngine_inflightCount).call(this) + batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)){
|
|
3374
|
-
var task = pipelineEngine_class_private_field_get(this, _queue).peek();
|
|
3375
|
-
if ("stream" === task.kind && (batch.length > 0 || pipelineEngine_class_private_method_get(this, pipelineEngine_inflightCount, core_pipelineEngine_inflightCount).call(this) > 0)) break;
|
|
3376
|
-
pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3377
|
-
batch.push(task);
|
|
3378
|
-
}
|
|
3379
|
-
if (0 === batch.length) return;
|
|
3380
|
-
var now = performance.now();
|
|
3381
|
-
var payload = buildBatchPayload(batch);
|
|
3382
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
3383
|
-
try {
|
|
3384
|
-
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3385
|
-
var task1 = _step.value;
|
|
3386
|
-
task1.startTime = now;
|
|
3387
|
-
}
|
|
3388
|
-
} catch (err) {
|
|
3389
|
-
_didIteratorError = true;
|
|
3390
|
-
_iteratorError = err;
|
|
3391
|
-
} finally{
|
|
3392
|
-
try {
|
|
3393
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3394
|
-
} finally{
|
|
3395
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
(_$_class_private_field_get = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)).push.apply(_$_class_private_field_get, pipelineEngine_to_consumable_array(batch));
|
|
3399
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_scheduleSweep, core_pipelineEngine_scheduleSweep).call(this);
|
|
3400
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).write(payload);
|
|
3401
|
-
}
|
|
3402
|
-
function core_pipelineEngine_handleParsedValue(raw) {
|
|
3403
|
-
var task = pipelineEngine_class_private_method_get(this, core_pipelineEngine_firstInflight, pipelineEngine_firstInflight).call(this);
|
|
3404
|
-
if (!task) return;
|
|
3405
|
-
if (isSentinelRaw(raw, task.token)) {
|
|
3406
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_shiftInflight, pipelineEngine_shiftInflight).call(this);
|
|
3407
|
-
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3408
|
-
if (task.consumerError) {
|
|
3409
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3410
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3414
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3415
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3416
|
-
return;
|
|
3417
|
-
}
|
|
3418
|
-
if ("[]" === raw) return;
|
|
3419
|
-
var parsed;
|
|
3420
|
-
try {
|
|
3421
|
-
parsed = JSON.parse(raw);
|
|
3422
|
-
} catch (error) {
|
|
3423
|
-
this.rejectAll(new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
3424
|
-
return;
|
|
3425
|
-
}
|
|
3426
|
-
if (isSentinelRow(parsed, task.token)) {
|
|
3427
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_shiftInflight, pipelineEngine_shiftInflight).call(this);
|
|
3428
|
-
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3429
|
-
if (task.consumerError) {
|
|
3430
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3431
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3432
|
-
return;
|
|
3433
|
-
}
|
|
3434
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3435
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3436
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3437
|
-
return;
|
|
3438
|
-
}
|
|
3439
|
-
if (task.timedout) return;
|
|
3440
|
-
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
3441
|
-
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
3770
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_pump).call(this);
|
|
3442
3771
|
}
|
|
3443
|
-
function
|
|
3772
|
+
function pipelineEngine_afterSentinel(task) {
|
|
3444
3773
|
var _this = this;
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
setImmediate(function() {
|
|
3448
|
-
pipelineEngine_class_private_field_set(_this, pipelineEngine_scheduledFinalize, false);
|
|
3449
|
-
finalizePendingTasks(pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks), function(t, e, v1) {
|
|
3774
|
+
handleSentinelTask(task, {
|
|
3775
|
+
settleTask: function(t, e, v1) {
|
|
3450
3776
|
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3451
|
-
},
|
|
3777
|
+
},
|
|
3778
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3779
|
+
scheduleFinalizeCheck: function() {
|
|
3780
|
+
return pipelineEngine_class_private_field_get(_this, pipelineEngine_scheduleFinalizeCheck).call(_this);
|
|
3781
|
+
},
|
|
3782
|
+
pumpQueue: function() {
|
|
3452
3783
|
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3453
|
-
});
|
|
3454
|
-
});
|
|
3455
|
-
}
|
|
3456
|
-
function core_pipelineEngine_scheduleSweep() {
|
|
3457
|
-
var _this = this;
|
|
3458
|
-
if (pipelineEngine_class_private_field_get(this, pipelineEngine_sweepTimer)) return;
|
|
3459
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_sweepTimer, setTimeout(function() {
|
|
3460
|
-
pipelineEngine_class_private_field_set(_this, pipelineEngine_sweepTimer, null);
|
|
3461
|
-
var tasks = pipelineEngine_class_private_field_get(_this, pipelineEngine_inflightTasks);
|
|
3462
|
-
var head = pipelineEngine_class_private_field_get(_this, pipelineEngine_inflightHead);
|
|
3463
|
-
var now = performance.now();
|
|
3464
|
-
for(var i = head; i < tasks.length; i++){
|
|
3465
|
-
var task = tasks[i];
|
|
3466
|
-
if (now - task.startTime > task.timeout) pipelineEngine_class_private_method_get(_this, core_pipelineEngine_handleTaskTimeout, pipelineEngine_handleTaskTimeout).call(_this, task);
|
|
3467
3784
|
}
|
|
3468
|
-
|
|
3469
|
-
}, pipelineEngine_class_private_field_get(this, pipelineEngine_sweepIntervalMs)).unref());
|
|
3470
|
-
}
|
|
3471
|
-
function pipelineEngine_handleTaskTimeout(task) {
|
|
3472
|
-
var _this, _this1;
|
|
3473
|
-
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics));
|
|
3474
|
-
if (error) {
|
|
3475
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, error, void 0);
|
|
3476
|
-
null == (_this = pipelineEngine_class_private_field_get(_this1 = this, _onTaskTimeout)) || _this.call(_this1, task);
|
|
3477
|
-
}
|
|
3785
|
+
});
|
|
3478
3786
|
}
|
|
3479
3787
|
function pipelineEngine_settleTask1(task, error, value) {
|
|
3480
|
-
|
|
3788
|
+
settleUtils_settleTask(task, error, value, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics), {
|
|
3481
3789
|
resetRowParser: true
|
|
3482
3790
|
});
|
|
3483
3791
|
}
|
|
@@ -3984,31 +4292,6 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
3984
4292
|
case 1:
|
|
3985
4293
|
_state.sent();
|
|
3986
4294
|
executor_class_private_field_get(_this, executor_processManager).kill();
|
|
3987
|
-
_state.label = 2;
|
|
3988
|
-
case 2:
|
|
3989
|
-
_state.trys.push([
|
|
3990
|
-
2,
|
|
3991
|
-
4,
|
|
3992
|
-
,
|
|
3993
|
-
5
|
|
3994
|
-
]);
|
|
3995
|
-
return [
|
|
3996
|
-
4,
|
|
3997
|
-
(0, __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__.once)(executor_class_private_field_get(_this, executor_processManager).process, "close")
|
|
3998
|
-
];
|
|
3999
|
-
case 3:
|
|
4000
|
-
_state.sent();
|
|
4001
|
-
return [
|
|
4002
|
-
3,
|
|
4003
|
-
5
|
|
4004
|
-
];
|
|
4005
|
-
case 4:
|
|
4006
|
-
_state.sent();
|
|
4007
|
-
return [
|
|
4008
|
-
3,
|
|
4009
|
-
5
|
|
4010
|
-
];
|
|
4011
|
-
case 5:
|
|
4012
4295
|
return [
|
|
4013
4296
|
2
|
|
4014
4297
|
];
|