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/cjs/index.cjs
CHANGED
|
@@ -55,7 +55,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
55
55
|
return metrics_Metrics;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
var external_node_events_namespaceObject = require("node:events");
|
|
59
58
|
var DEFAULT_STATEMENT_TIMEOUT = 30000;
|
|
60
59
|
function createTimeoutError(timeout, sql) {
|
|
61
60
|
return new Error("SQLite statement timed out after ".concat(timeout, "ms: ").concat(sql));
|
|
@@ -266,7 +265,8 @@ function createRowStreamParser(onRow) {
|
|
|
266
265
|
}
|
|
267
266
|
index = consumed;
|
|
268
267
|
if (consumed > 65536) {
|
|
269
|
-
|
|
268
|
+
buffer = buffer.slice(consumed);
|
|
269
|
+
this.buffer = buffer;
|
|
270
270
|
this._consumed = 0;
|
|
271
271
|
index = 0;
|
|
272
272
|
consumed = 0;
|
|
@@ -317,6 +317,7 @@ function createRowStreamParser(onRow) {
|
|
|
317
317
|
var TOKEN_COLUMN = "__sqlite_executor_token__";
|
|
318
318
|
var DEFAULT_BATCH_SIZE = 10;
|
|
319
319
|
var DEFAULT_MAX_INFLIGHT = 50;
|
|
320
|
+
var INFLIGHT_COMPACT_THRESHOLD = 128;
|
|
320
321
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
321
322
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
322
323
|
}
|
|
@@ -390,7 +391,7 @@ function _type_of(obj) {
|
|
|
390
391
|
}
|
|
391
392
|
var _computedKey;
|
|
392
393
|
function setupStreamParser(task) {
|
|
393
|
-
var
|
|
394
|
+
var pipelineOrFeed = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
|
|
394
395
|
feed: function() {}
|
|
395
396
|
};
|
|
396
397
|
if ("stream" !== task.kind) return null;
|
|
@@ -398,7 +399,7 @@ function setupStreamParser(task) {
|
|
|
398
399
|
if (task.consumerError) return;
|
|
399
400
|
try {
|
|
400
401
|
var row = JSON.parse(rawRow);
|
|
401
|
-
if ((void 0 === row ? "undefined" : _type_of(row)) === "object" && null !== row && TOKEN_COLUMN in row) return void
|
|
402
|
+
if ((void 0 === row ? "undefined" : _type_of(row)) === "object" && null !== row && TOKEN_COLUMN in row) return void pipelineOrFeed.feed("[".concat(rawRow, "]"));
|
|
402
403
|
task.onRow(row);
|
|
403
404
|
} catch (error) {
|
|
404
405
|
task.consumerError = toError(error);
|
|
@@ -600,16 +601,19 @@ function createTransactionHandle(scopeId, executor) {
|
|
|
600
601
|
return handle;
|
|
601
602
|
}
|
|
602
603
|
var external_node_child_process_namespaceObject = require("node:child_process");
|
|
604
|
+
var external_node_events_namespaceObject = require("node:events");
|
|
603
605
|
var external_node_fs_namespaceObject = require("node:fs");
|
|
604
606
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
605
607
|
var external_node_path_namespaceObject = require("node:path");
|
|
606
608
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
607
609
|
var external_node_os_namespaceObject = require("node:os");
|
|
608
610
|
var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
|
|
609
|
-
|
|
611
|
+
function isWindows() {
|
|
612
|
+
return "win32" === external_node_os_default().platform();
|
|
613
|
+
}
|
|
610
614
|
function isExecutable(filePath) {
|
|
611
615
|
try {
|
|
612
|
-
if (isWindows) return external_node_fs_default().statSync(filePath).isFile();
|
|
616
|
+
if (isWindows()) return external_node_fs_default().statSync(filePath).isFile();
|
|
613
617
|
external_node_fs_default().accessSync(filePath, external_node_fs_default().constants.X_OK);
|
|
614
618
|
return true;
|
|
615
619
|
} catch (e) {
|
|
@@ -617,7 +621,7 @@ function isExecutable(filePath) {
|
|
|
617
621
|
}
|
|
618
622
|
}
|
|
619
623
|
function getPathExts() {
|
|
620
|
-
if (!isWindows) return [
|
|
624
|
+
if (!isWindows()) return [
|
|
621
625
|
""
|
|
622
626
|
];
|
|
623
627
|
var ext = process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM;.PS1";
|
|
@@ -630,7 +634,7 @@ function which(command) {
|
|
|
630
634
|
var pathExts = getPathExts();
|
|
631
635
|
if (command.includes(external_node_path_default().sep)) {
|
|
632
636
|
var fullPath = external_node_path_default().resolve(command);
|
|
633
|
-
if (!isWindows) return isExecutable(fullPath) ? fullPath : null;
|
|
637
|
+
if (!isWindows()) return isExecutable(fullPath) ? fullPath : null;
|
|
634
638
|
if (external_node_path_default().extname(fullPath)) return isExecutable(fullPath) ? fullPath : null;
|
|
635
639
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
636
640
|
try {
|
|
@@ -657,7 +661,7 @@ function which(command) {
|
|
|
657
661
|
try {
|
|
658
662
|
for(var _iterator1 = pathDirs[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
659
663
|
var dir = _step1.value;
|
|
660
|
-
if (dir) if (isWindows) {
|
|
664
|
+
if (dir) if (isWindows()) {
|
|
661
665
|
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
662
666
|
try {
|
|
663
667
|
for(var _iterator2 = pathExts[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
@@ -752,6 +756,14 @@ function process_class_private_field_set(receiver, privateMap, value) {
|
|
|
752
756
|
process_class_apply_descriptor_set(receiver, descriptor, value);
|
|
753
757
|
return value;
|
|
754
758
|
}
|
|
759
|
+
function _class_private_method_get(receiver, privateSet, fn) {
|
|
760
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
761
|
+
return fn;
|
|
762
|
+
}
|
|
763
|
+
function _class_private_method_init(obj, privateSet) {
|
|
764
|
+
process_check_private_redeclaration(obj, privateSet);
|
|
765
|
+
privateSet.add(obj);
|
|
766
|
+
}
|
|
755
767
|
function process_defineProperties(target, props) {
|
|
756
768
|
for(var i = 0; i < props.length; i++){
|
|
757
769
|
var descriptor = props[i];
|
|
@@ -858,12 +870,14 @@ function _ts_generator(thisArg, body) {
|
|
|
858
870
|
}
|
|
859
871
|
}
|
|
860
872
|
var GRACEFUL_SHUTDOWN_TIMEOUT = 5000;
|
|
861
|
-
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();
|
|
873
|
+
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();
|
|
862
874
|
var process_ProcessManager = /*#__PURE__*/ function() {
|
|
863
875
|
"use strict";
|
|
864
876
|
function ProcessManager() {
|
|
865
877
|
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;
|
|
866
878
|
process_class_call_check(this, ProcessManager);
|
|
879
|
+
_class_private_method_init(this, _flushBuffer);
|
|
880
|
+
_class_private_method_init(this, _notifyIfDrained);
|
|
867
881
|
process_class_private_field_init(this, _binary, {
|
|
868
882
|
writable: true,
|
|
869
883
|
value: void 0
|
|
@@ -884,6 +898,14 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
884
898
|
writable: true,
|
|
885
899
|
value: false
|
|
886
900
|
});
|
|
901
|
+
process_class_private_field_init(this, _writeBuffer, {
|
|
902
|
+
writable: true,
|
|
903
|
+
value: []
|
|
904
|
+
});
|
|
905
|
+
process_class_private_field_init(this, _drainCallbacks, {
|
|
906
|
+
writable: true,
|
|
907
|
+
value: []
|
|
908
|
+
});
|
|
887
909
|
process_class_private_field_init(this, _onDrain, {
|
|
888
910
|
writable: true,
|
|
889
911
|
value: void 0
|
|
@@ -907,6 +929,13 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
907
929
|
process_class_private_field_set(this, _onDrain, fn);
|
|
908
930
|
}
|
|
909
931
|
},
|
|
932
|
+
{
|
|
933
|
+
key: "onDrained",
|
|
934
|
+
value: function(callback) {
|
|
935
|
+
if (!process_class_private_field_get(this, _draining) && 0 === process_class_private_field_get(this, _writeBuffer).length) return void callback();
|
|
936
|
+
process_class_private_field_get(this, _drainCallbacks).push(callback);
|
|
937
|
+
}
|
|
938
|
+
},
|
|
910
939
|
{
|
|
911
940
|
key: "binary",
|
|
912
941
|
get: function() {
|
|
@@ -922,9 +951,9 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
922
951
|
{
|
|
923
952
|
key: "start",
|
|
924
953
|
value: function() {
|
|
925
|
-
var _proc_stdin, _proc_stdout, _proc_stderr;
|
|
954
|
+
var _proc_stdin, _proc_stdout, _proc_stderr, _proc_stdin1;
|
|
926
955
|
if (!process_class_private_field_get(this, _binary)) throw new Error("sqlite3 binary path is empty. Provide a valid --binary / binary option.");
|
|
927
|
-
if (!external_node_fs_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."));
|
|
956
|
+
if (external_node_path_default().isAbsolute(process_class_private_field_get(this, _binary)) && !external_node_fs_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."));
|
|
928
957
|
var args = [
|
|
929
958
|
"-json"
|
|
930
959
|
];
|
|
@@ -941,6 +970,7 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
941
970
|
null == (_proc_stdin = proc.stdin) || _proc_stdin.setDefaultEncoding("utf-8");
|
|
942
971
|
null == (_proc_stdout = proc.stdout) || _proc_stdout.setEncoding("utf-8");
|
|
943
972
|
null == (_proc_stderr = proc.stderr) || _proc_stderr.setEncoding("utf-8");
|
|
973
|
+
null == (_proc_stdin1 = proc.stdin) || _proc_stdin1.on("error", function() {});
|
|
944
974
|
process_class_private_field_set(this, _proc, proc);
|
|
945
975
|
return proc;
|
|
946
976
|
}
|
|
@@ -952,11 +982,13 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
952
982
|
var _$_class_private_field_get;
|
|
953
983
|
var stream = null == (_$_class_private_field_get = process_class_private_field_get(this, _proc)) ? void 0 : _$_class_private_field_get.stdin;
|
|
954
984
|
if (!stream) return;
|
|
955
|
-
if (process_class_private_field_get(this, _draining)) return;
|
|
985
|
+
if (process_class_private_field_get(this, _draining)) return void process_class_private_field_get(this, _writeBuffer).push(data);
|
|
956
986
|
if (!stream.write(data)) {
|
|
957
987
|
process_class_private_field_set(this, _draining, true);
|
|
958
988
|
stream.once("drain", function() {
|
|
959
989
|
process_class_private_field_set(_this, _draining, false);
|
|
990
|
+
_class_private_method_get(_this, _flushBuffer, flushBuffer).call(_this);
|
|
991
|
+
_class_private_method_get(_this, _notifyIfDrained, notifyIfDrained).call(_this);
|
|
960
992
|
process_class_private_field_get(_this, _onDrain).call(_this);
|
|
961
993
|
});
|
|
962
994
|
}
|
|
@@ -975,40 +1007,58 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
975
1007
|
if (!proc) return [
|
|
976
1008
|
2
|
|
977
1009
|
];
|
|
1010
|
+
if (!(process_class_private_field_get(_this, _draining) || process_class_private_field_get(_this, _writeBuffer).length > 0)) return [
|
|
1011
|
+
3,
|
|
1012
|
+
2
|
|
1013
|
+
];
|
|
1014
|
+
return [
|
|
1015
|
+
4,
|
|
1016
|
+
new Promise(function(resolve) {
|
|
1017
|
+
var timer = setTimeout(resolve, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
1018
|
+
_this.onDrained(function() {
|
|
1019
|
+
clearTimeout(timer);
|
|
1020
|
+
resolve();
|
|
1021
|
+
});
|
|
1022
|
+
})
|
|
1023
|
+
];
|
|
1024
|
+
case 1:
|
|
1025
|
+
_state.sent();
|
|
1026
|
+
_state.label = 2;
|
|
1027
|
+
case 2:
|
|
978
1028
|
timer = setTimeout(function() {
|
|
979
1029
|
proc.kill();
|
|
980
|
-
}, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
981
|
-
_state.label =
|
|
982
|
-
case
|
|
1030
|
+
}, GRACEFUL_SHUTDOWN_TIMEOUT).unref();
|
|
1031
|
+
_state.label = 3;
|
|
1032
|
+
case 3:
|
|
983
1033
|
_state.trys.push([
|
|
984
|
-
1,
|
|
985
1034
|
3,
|
|
986
|
-
|
|
987
|
-
|
|
1035
|
+
5,
|
|
1036
|
+
6,
|
|
1037
|
+
7
|
|
988
1038
|
]);
|
|
989
1039
|
null == (_proc_stdin = proc.stdin) || _proc_stdin.write(".quit\n");
|
|
990
1040
|
return [
|
|
991
1041
|
4,
|
|
992
1042
|
(0, external_node_events_namespaceObject.once)(proc, "close")
|
|
993
1043
|
];
|
|
994
|
-
case
|
|
1044
|
+
case 4:
|
|
995
1045
|
_state.sent();
|
|
996
1046
|
return [
|
|
997
1047
|
3,
|
|
998
|
-
|
|
1048
|
+
7
|
|
999
1049
|
];
|
|
1000
|
-
case
|
|
1050
|
+
case 5:
|
|
1001
1051
|
_state.sent();
|
|
1002
1052
|
return [
|
|
1003
1053
|
3,
|
|
1004
|
-
|
|
1054
|
+
7
|
|
1005
1055
|
];
|
|
1006
|
-
case
|
|
1056
|
+
case 6:
|
|
1007
1057
|
clearTimeout(timer);
|
|
1008
1058
|
return [
|
|
1009
1059
|
7
|
|
1010
1060
|
];
|
|
1011
|
-
case
|
|
1061
|
+
case 7:
|
|
1012
1062
|
return [
|
|
1013
1063
|
2
|
|
1014
1064
|
];
|
|
@@ -1025,6 +1075,8 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1025
1075
|
if (!proc) return null;
|
|
1026
1076
|
process_class_private_field_set(this, _proc, null);
|
|
1027
1077
|
process_class_private_field_set(this, _draining, false);
|
|
1078
|
+
process_class_private_field_set(this, _writeBuffer, []);
|
|
1079
|
+
process_class_private_field_set(this, _drainCallbacks, []);
|
|
1028
1080
|
null == (_proc_stdout = proc.stdout) || _proc_stdout.removeAllListeners();
|
|
1029
1081
|
null == (_proc_stderr = proc.stderr) || _proc_stderr.removeAllListeners();
|
|
1030
1082
|
proc.removeAllListeners();
|
|
@@ -1036,6 +1088,47 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1036
1088
|
]);
|
|
1037
1089
|
return ProcessManager;
|
|
1038
1090
|
}();
|
|
1091
|
+
function flushBuffer() {
|
|
1092
|
+
var buffer = process_class_private_field_get(this, _writeBuffer);
|
|
1093
|
+
process_class_private_field_set(this, _writeBuffer, []);
|
|
1094
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1095
|
+
try {
|
|
1096
|
+
for(var _iterator = buffer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1097
|
+
var data = _step.value;
|
|
1098
|
+
this.write(data);
|
|
1099
|
+
}
|
|
1100
|
+
} catch (err) {
|
|
1101
|
+
_didIteratorError = true;
|
|
1102
|
+
_iteratorError = err;
|
|
1103
|
+
} finally{
|
|
1104
|
+
try {
|
|
1105
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1106
|
+
} finally{
|
|
1107
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
function notifyIfDrained() {
|
|
1112
|
+
if (process_class_private_field_get(this, _draining)) return;
|
|
1113
|
+
var callbacks = process_class_private_field_get(this, _drainCallbacks);
|
|
1114
|
+
process_class_private_field_set(this, _drainCallbacks, []);
|
|
1115
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1116
|
+
try {
|
|
1117
|
+
for(var _iterator = callbacks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1118
|
+
var cb = _step.value;
|
|
1119
|
+
cb();
|
|
1120
|
+
}
|
|
1121
|
+
} catch (err) {
|
|
1122
|
+
_didIteratorError = true;
|
|
1123
|
+
_iteratorError = err;
|
|
1124
|
+
} finally{
|
|
1125
|
+
try {
|
|
1126
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1127
|
+
} finally{
|
|
1128
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1039
1132
|
var _counter = 0;
|
|
1040
1133
|
var _PREFIX = "__executor_end__";
|
|
1041
1134
|
var _PID36 = process.pid.toString(36);
|
|
@@ -1133,7 +1226,8 @@ var lruCache_LRUCache = /*#__PURE__*/ function() {
|
|
|
1133
1226
|
key: "set",
|
|
1134
1227
|
value: function(key, value) {
|
|
1135
1228
|
if ("string" != typeof key || key.length > lruCache_class_private_field_get(this, _maxKeyLength)) return;
|
|
1136
|
-
if (value && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1229
|
+
if ("string" == typeof value && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1230
|
+
if (Array.isArray(value) && value.length > lruCache_class_private_field_get(this, _maxValueLength)) return;
|
|
1137
1231
|
if (lruCache_class_private_field_get(this, _map).size >= lruCache_class_private_field_get(this, _maxSize)) {
|
|
1138
1232
|
var firstKey = lruCache_class_private_field_get(this, _map).keys().next().value;
|
|
1139
1233
|
lruCache_class_private_field_get(this, _map)["delete"](firstKey);
|
|
@@ -1199,7 +1293,19 @@ var constants_STATE_SINGLE_QUOTE = 1;
|
|
|
1199
1293
|
var constants_STATE_DOUBLE_QUOTE = 2;
|
|
1200
1294
|
var constants_STATE_LINE_COMMENT = 3;
|
|
1201
1295
|
var constants_STATE_BLOCK_COMMENT = 4;
|
|
1202
|
-
|
|
1296
|
+
function _decodeU16(codes) {
|
|
1297
|
+
var len = codes.length;
|
|
1298
|
+
if (0 === len) return "";
|
|
1299
|
+
var batchSize = 1024;
|
|
1300
|
+
if (len <= batchSize) return String.fromCharCode.apply(null, codes);
|
|
1301
|
+
var parts = new Array(Math.ceil(len / batchSize));
|
|
1302
|
+
for(var i = 0; i < parts.length; i++){
|
|
1303
|
+
var start = i * batchSize;
|
|
1304
|
+
var end = Math.min(start + batchSize, len);
|
|
1305
|
+
parts[i] = String.fromCharCode.apply(null, codes.subarray(start, end));
|
|
1306
|
+
}
|
|
1307
|
+
return parts.join("");
|
|
1308
|
+
}
|
|
1203
1309
|
var _normCache = new lruCache_LRUCache({
|
|
1204
1310
|
maxSize: 256,
|
|
1205
1311
|
maxKeyLength: 4096
|
|
@@ -1280,7 +1386,7 @@ function _normalize(sql) {
|
|
|
1280
1386
|
else {
|
|
1281
1387
|
while(writePos > 0 && outCodes[writePos - 1] === CC_SEMICOLON)writePos--;
|
|
1282
1388
|
outCodes[writePos++] = CC_SEMICOLON;
|
|
1283
|
-
normalized =
|
|
1389
|
+
normalized = _decodeU16(outCodes.subarray(0, writePos));
|
|
1284
1390
|
}
|
|
1285
1391
|
var paramCount = questionPositions.length;
|
|
1286
1392
|
if (0 === paramCount) return {
|
|
@@ -1342,8 +1448,8 @@ var _classifyCache = new lruCache_LRUCache({
|
|
|
1342
1448
|
});
|
|
1343
1449
|
function classifySingle(stmt) {
|
|
1344
1450
|
var trimmed = stmt.trim();
|
|
1345
|
-
|
|
1346
|
-
var kind = trimmed.
|
|
1451
|
+
var firstSpace = trimmed.indexOf(" ");
|
|
1452
|
+
var kind = (-1 === firstSpace ? trimmed : trimmed.slice(0, firstSpace)).toUpperCase();
|
|
1347
1453
|
return READ_ONLY_KINDS.has(kind) ? "read" : "write";
|
|
1348
1454
|
}
|
|
1349
1455
|
function classifySQL(sql) {
|
|
@@ -1436,11 +1542,11 @@ function queue_class_private_field_update(receiver, privateMap) {
|
|
|
1436
1542
|
var descriptor = queue_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1437
1543
|
return queue_class_apply_descriptor_update(receiver, descriptor);
|
|
1438
1544
|
}
|
|
1439
|
-
function
|
|
1545
|
+
function queue_class_private_method_get(receiver, privateSet, fn) {
|
|
1440
1546
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1441
1547
|
return fn;
|
|
1442
1548
|
}
|
|
1443
|
-
function
|
|
1549
|
+
function queue_class_private_method_init(obj, privateSet) {
|
|
1444
1550
|
queue_check_private_redeclaration(obj, privateSet);
|
|
1445
1551
|
privateSet.add(obj);
|
|
1446
1552
|
}
|
|
@@ -1559,8 +1665,8 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1559
1665
|
"use strict";
|
|
1560
1666
|
function Queue() {
|
|
1561
1667
|
queue_class_call_check(this, Queue);
|
|
1562
|
-
|
|
1563
|
-
|
|
1668
|
+
queue_class_private_method_init(this, _grow);
|
|
1669
|
+
queue_class_private_method_init(this, _shrinkIfNeeded);
|
|
1564
1670
|
queue_class_private_field_init(this, _items, {
|
|
1565
1671
|
writable: true,
|
|
1566
1672
|
value: new Array(INITIAL_CAPACITY)
|
|
@@ -1586,7 +1692,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1586
1692
|
{
|
|
1587
1693
|
key: "enqueue",
|
|
1588
1694
|
value: function(value) {
|
|
1589
|
-
if (queue_class_private_field_get(this, _size) === queue_class_private_field_get(this, _items).length)
|
|
1695
|
+
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);
|
|
1590
1696
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = value;
|
|
1591
1697
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) + 1 & queue_class_private_field_get(this, _mask));
|
|
1592
1698
|
queue_class_private_field_update(this, _size).value++;
|
|
@@ -1610,7 +1716,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1610
1716
|
queue_class_private_field_set(this, _head, 0);
|
|
1611
1717
|
queue_class_private_field_set(this, _tail, 0);
|
|
1612
1718
|
queue_class_private_field_set(this, _size, 0);
|
|
1613
|
-
|
|
1719
|
+
queue_class_private_method_get(this, _shrinkIfNeeded, shrinkIfNeeded).call(this);
|
|
1614
1720
|
}
|
|
1615
1721
|
},
|
|
1616
1722
|
{
|
|
@@ -1771,6 +1877,229 @@ function shrinkIfNeeded() {
|
|
|
1771
1877
|
queue_class_private_field_set(this, _mask, INITIAL_CAPACITY - 1);
|
|
1772
1878
|
}
|
|
1773
1879
|
}
|
|
1880
|
+
function _array_like_to_array(arr, len) {
|
|
1881
|
+
if (null == len || len > arr.length) len = arr.length;
|
|
1882
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1883
|
+
return arr2;
|
|
1884
|
+
}
|
|
1885
|
+
function _array_without_holes(arr) {
|
|
1886
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1887
|
+
}
|
|
1888
|
+
function inflightTracker_check_private_redeclaration(obj, privateCollection) {
|
|
1889
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1890
|
+
}
|
|
1891
|
+
function inflightTracker_class_apply_descriptor_get(receiver, descriptor) {
|
|
1892
|
+
if (descriptor.get) return descriptor.get.call(receiver);
|
|
1893
|
+
return descriptor.value;
|
|
1894
|
+
}
|
|
1895
|
+
function inflightTracker_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
1896
|
+
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
1897
|
+
else {
|
|
1898
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1899
|
+
descriptor.value = value;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
function inflightTracker_class_apply_descriptor_update(receiver, descriptor) {
|
|
1903
|
+
if (descriptor.set) {
|
|
1904
|
+
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1905
|
+
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
1906
|
+
set value (v){
|
|
1907
|
+
descriptor.set.call(receiver, v);
|
|
1908
|
+
},
|
|
1909
|
+
get value () {
|
|
1910
|
+
return descriptor.get.call(receiver);
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
return descriptor.__destrWrapper;
|
|
1914
|
+
}
|
|
1915
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1916
|
+
return descriptor;
|
|
1917
|
+
}
|
|
1918
|
+
function inflightTracker_class_call_check(instance, Constructor) {
|
|
1919
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1920
|
+
}
|
|
1921
|
+
function inflightTracker_class_extract_field_descriptor(receiver, privateMap, action) {
|
|
1922
|
+
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
1923
|
+
return privateMap.get(receiver);
|
|
1924
|
+
}
|
|
1925
|
+
function inflightTracker_class_private_field_get(receiver, privateMap) {
|
|
1926
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "get");
|
|
1927
|
+
return inflightTracker_class_apply_descriptor_get(receiver, descriptor);
|
|
1928
|
+
}
|
|
1929
|
+
function inflightTracker_class_private_field_init(obj, privateMap, value) {
|
|
1930
|
+
inflightTracker_check_private_redeclaration(obj, privateMap);
|
|
1931
|
+
privateMap.set(obj, value);
|
|
1932
|
+
}
|
|
1933
|
+
function inflightTracker_class_private_field_set(receiver, privateMap, value) {
|
|
1934
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
1935
|
+
inflightTracker_class_apply_descriptor_set(receiver, descriptor, value);
|
|
1936
|
+
return value;
|
|
1937
|
+
}
|
|
1938
|
+
function inflightTracker_class_private_field_update(receiver, privateMap) {
|
|
1939
|
+
var descriptor = inflightTracker_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1940
|
+
return inflightTracker_class_apply_descriptor_update(receiver, descriptor);
|
|
1941
|
+
}
|
|
1942
|
+
function inflightTracker_defineProperties(target, props) {
|
|
1943
|
+
for(var i = 0; i < props.length; i++){
|
|
1944
|
+
var descriptor = props[i];
|
|
1945
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1946
|
+
descriptor.configurable = true;
|
|
1947
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1948
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
function inflightTracker_create_class(Constructor, protoProps, staticProps) {
|
|
1952
|
+
if (protoProps) inflightTracker_defineProperties(Constructor.prototype, protoProps);
|
|
1953
|
+
if (staticProps) inflightTracker_defineProperties(Constructor, staticProps);
|
|
1954
|
+
return Constructor;
|
|
1955
|
+
}
|
|
1956
|
+
function _iterable_to_array(iter) {
|
|
1957
|
+
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
1958
|
+
}
|
|
1959
|
+
function _non_iterable_spread() {
|
|
1960
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1961
|
+
}
|
|
1962
|
+
function _to_consumable_array(arr) {
|
|
1963
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
1964
|
+
}
|
|
1965
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
1966
|
+
if (!o) return;
|
|
1967
|
+
if ("string" == typeof o) return _array_like_to_array(o, minLen);
|
|
1968
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1969
|
+
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
1970
|
+
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
1971
|
+
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1972
|
+
}
|
|
1973
|
+
var _tasks = /*#__PURE__*/ new WeakMap(), inflightTracker_head = /*#__PURE__*/ new WeakMap();
|
|
1974
|
+
var inflightTracker_InflightTracker = /*#__PURE__*/ function() {
|
|
1975
|
+
"use strict";
|
|
1976
|
+
function InflightTracker() {
|
|
1977
|
+
inflightTracker_class_call_check(this, InflightTracker);
|
|
1978
|
+
inflightTracker_class_private_field_init(this, _tasks, {
|
|
1979
|
+
writable: true,
|
|
1980
|
+
value: []
|
|
1981
|
+
});
|
|
1982
|
+
inflightTracker_class_private_field_init(this, inflightTracker_head, {
|
|
1983
|
+
writable: true,
|
|
1984
|
+
value: 0
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
inflightTracker_create_class(InflightTracker, [
|
|
1988
|
+
{
|
|
1989
|
+
key: "count",
|
|
1990
|
+
get: function() {
|
|
1991
|
+
return inflightTracker_class_private_field_get(this, _tasks).length - inflightTracker_class_private_field_get(this, inflightTracker_head);
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
key: "first",
|
|
1996
|
+
get: function() {
|
|
1997
|
+
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;
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
key: "push",
|
|
2002
|
+
value: function() {
|
|
2003
|
+
for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++)items[_key] = arguments[_key];
|
|
2004
|
+
var _$_class_private_field_get;
|
|
2005
|
+
(_$_class_private_field_get = inflightTracker_class_private_field_get(this, _tasks)).push.apply(_$_class_private_field_get, _to_consumable_array(items));
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
key: "shift",
|
|
2010
|
+
value: function() {
|
|
2011
|
+
if (inflightTracker_class_private_field_get(this, _tasks).length === inflightTracker_class_private_field_get(this, inflightTracker_head)) return null;
|
|
2012
|
+
var task = inflightTracker_class_private_field_get(this, _tasks)[inflightTracker_class_private_field_get(this, inflightTracker_head)];
|
|
2013
|
+
inflightTracker_class_private_field_get(this, _tasks)[inflightTracker_class_private_field_get(this, inflightTracker_head)] = null;
|
|
2014
|
+
inflightTracker_class_private_field_update(this, inflightTracker_head).value++;
|
|
2015
|
+
if (inflightTracker_class_private_field_get(this, inflightTracker_head) >= inflightTracker_class_private_field_get(this, _tasks).length) {
|
|
2016
|
+
inflightTracker_class_private_field_set(this, _tasks, []);
|
|
2017
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
2018
|
+
} else if (inflightTracker_class_private_field_get(this, inflightTracker_head) > INFLIGHT_COMPACT_THRESHOLD) {
|
|
2019
|
+
inflightTracker_class_private_field_set(this, _tasks, inflightTracker_class_private_field_get(this, _tasks).slice(inflightTracker_class_private_field_get(this, inflightTracker_head)));
|
|
2020
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
2021
|
+
}
|
|
2022
|
+
return task;
|
|
2023
|
+
}
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
key: "clear",
|
|
2027
|
+
value: function() {
|
|
2028
|
+
inflightTracker_class_private_field_set(this, _tasks, []);
|
|
2029
|
+
inflightTracker_class_private_field_set(this, inflightTracker_head, 0);
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
key: "forEach",
|
|
2034
|
+
value: function(fn) {
|
|
2035
|
+
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]);
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
key: "toArray",
|
|
2040
|
+
value: function() {
|
|
2041
|
+
return inflightTracker_class_private_field_get(this, _tasks).slice(inflightTracker_class_private_field_get(this, inflightTracker_head));
|
|
2042
|
+
}
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
key: "_tasksLength",
|
|
2046
|
+
get: function() {
|
|
2047
|
+
return inflightTracker_class_private_field_get(this, _tasks).length;
|
|
2048
|
+
}
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
key: "_head",
|
|
2052
|
+
get: function() {
|
|
2053
|
+
return inflightTracker_class_private_field_get(this, inflightTracker_head);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
]);
|
|
2057
|
+
return InflightTracker;
|
|
2058
|
+
}();
|
|
2059
|
+
function collectQueryRows(task, parsed) {
|
|
2060
|
+
if (Array.isArray(parsed)) for(var i = 0; i < parsed.length; i++)task.rows.push(parsed[i]);
|
|
2061
|
+
}
|
|
2062
|
+
function processStreamRows(task, parsed) {
|
|
2063
|
+
if (!Array.isArray(parsed)) return;
|
|
2064
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2065
|
+
try {
|
|
2066
|
+
for(var _iterator = parsed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2067
|
+
var row = _step.value;
|
|
2068
|
+
if (task.consumerError) break;
|
|
2069
|
+
try {
|
|
2070
|
+
task.onRow(row);
|
|
2071
|
+
} catch (error) {
|
|
2072
|
+
task.consumerError = toError(error);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
} catch (err) {
|
|
2076
|
+
_didIteratorError = true;
|
|
2077
|
+
_iteratorError = err;
|
|
2078
|
+
} finally{
|
|
2079
|
+
try {
|
|
2080
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2081
|
+
} finally{
|
|
2082
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
function settleUtils_settleTask(task, error, value, metrics) {
|
|
2087
|
+
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
2088
|
+
if (task.settled) return;
|
|
2089
|
+
task.settled = true;
|
|
2090
|
+
if (resetRowParser) {
|
|
2091
|
+
var _task_rowParser_reset, _task_rowParser;
|
|
2092
|
+
null == (_task_rowParser = task.rowParser) || null == (_task_rowParser_reset = _task_rowParser.reset) || _task_rowParser_reset.call(_task_rowParser);
|
|
2093
|
+
}
|
|
2094
|
+
if (error) {
|
|
2095
|
+
null == metrics || metrics.incrementTasksFailed();
|
|
2096
|
+
task.reject(toError(error));
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
var duration = task.startTime > 0 ? performance.now() - task.startTime : 0;
|
|
2100
|
+
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
2101
|
+
task.resolve(value);
|
|
2102
|
+
}
|
|
1774
2103
|
function buildPayload(sql, token) {
|
|
1775
2104
|
var _ref = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, _ref_skipNormalize = _ref.skipNormalize, skipNormalize = void 0 === _ref_skipNormalize ? false : _ref_skipNormalize;
|
|
1776
2105
|
var normalized = skipNormalize ? sql : normalizeSQL(sql);
|
|
@@ -1859,58 +2188,71 @@ function isSentinelRow(value, token) {
|
|
|
1859
2188
|
var _value_;
|
|
1860
2189
|
return Array.isArray(value) && 1 === value.length && (null == (_value_ = value[0]) ? void 0 : _value_[TOKEN_COLUMN]) === token;
|
|
1861
2190
|
}
|
|
1862
|
-
function
|
|
1863
|
-
if (
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
}
|
|
2191
|
+
function pipelineUtils_array_like_to_array(arr, len) {
|
|
2192
|
+
if (null == len || len > arr.length) len = arr.length;
|
|
2193
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2194
|
+
return arr2;
|
|
1867
2195
|
}
|
|
1868
|
-
function
|
|
1869
|
-
if (
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2196
|
+
function pipelineUtils_array_without_holes(arr) {
|
|
2197
|
+
if (Array.isArray(arr)) return pipelineUtils_array_like_to_array(arr);
|
|
2198
|
+
}
|
|
2199
|
+
function pipelineUtils_iterable_to_array(iter) {
|
|
2200
|
+
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
2201
|
+
}
|
|
2202
|
+
function pipelineUtils_non_iterable_spread() {
|
|
2203
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2204
|
+
}
|
|
2205
|
+
function pipelineUtils_to_consumable_array(arr) {
|
|
2206
|
+
return pipelineUtils_array_without_holes(arr) || pipelineUtils_iterable_to_array(arr) || pipelineUtils_unsupported_iterable_to_array(arr) || pipelineUtils_non_iterable_spread();
|
|
2207
|
+
}
|
|
2208
|
+
function pipelineUtils_unsupported_iterable_to_array(o, minLen) {
|
|
2209
|
+
if (!o) return;
|
|
2210
|
+
if ("string" == typeof o) return pipelineUtils_array_like_to_array(o, minLen);
|
|
2211
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2212
|
+
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
2213
|
+
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
2214
|
+
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineUtils_array_like_to_array(o, minLen);
|
|
2215
|
+
}
|
|
2216
|
+
function finalizePendingTasks(tasks, settle, pumpQueue, pendingStderr, inflight) {
|
|
2217
|
+
var hasStderrBuffer = pendingStderr && pendingStderr.length > 0;
|
|
2218
|
+
if (hasStderrBuffer) {
|
|
2219
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1885
2220
|
try {
|
|
1886
|
-
|
|
2221
|
+
for(var _iterator = pendingStderr[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2222
|
+
var chunk = _step.value;
|
|
2223
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2224
|
+
try {
|
|
2225
|
+
for(var _iterator1 = tasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2226
|
+
var t = _step1.value;
|
|
2227
|
+
if ("query" === t.kind && 0 === t.rows.length) t.stderrText += chunk;
|
|
2228
|
+
}
|
|
2229
|
+
} catch (err) {
|
|
2230
|
+
_didIteratorError1 = true;
|
|
2231
|
+
_iteratorError1 = err;
|
|
2232
|
+
} finally{
|
|
2233
|
+
try {
|
|
2234
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2235
|
+
} finally{
|
|
2236
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
} catch (err) {
|
|
2241
|
+
_didIteratorError = true;
|
|
2242
|
+
_iteratorError = err;
|
|
1887
2243
|
} finally{
|
|
1888
|
-
|
|
2244
|
+
try {
|
|
2245
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2246
|
+
} finally{
|
|
2247
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2248
|
+
}
|
|
1889
2249
|
}
|
|
2250
|
+
if (!inflight || 0 === inflight.count) pendingStderr.length = 0;
|
|
1890
2251
|
}
|
|
1891
|
-
|
|
1892
|
-
function settleTask(task, error, value, metrics) {
|
|
1893
|
-
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
1894
|
-
if (task.settled) return;
|
|
1895
|
-
task.settled = true;
|
|
1896
|
-
if (resetRowParser) {
|
|
1897
|
-
var _task_rowParser_reset, _task_rowParser;
|
|
1898
|
-
null == (_task_rowParser = task.rowParser) || null == (_task_rowParser_reset = _task_rowParser.reset) || _task_rowParser_reset.call(_task_rowParser);
|
|
1899
|
-
}
|
|
1900
|
-
if (error) {
|
|
1901
|
-
null == metrics || metrics.incrementTasksFailed();
|
|
1902
|
-
task.reject(toError(error));
|
|
1903
|
-
return;
|
|
1904
|
-
}
|
|
1905
|
-
var duration = task.startTime > 0 ? performance.now() - task.startTime : 0;
|
|
1906
|
-
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
1907
|
-
task.resolve(value);
|
|
1908
|
-
}
|
|
1909
|
-
function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
1910
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2252
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
1911
2253
|
try {
|
|
1912
|
-
for(var
|
|
1913
|
-
var task =
|
|
2254
|
+
for(var _iterator2 = tasks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2255
|
+
var task = _step2.value;
|
|
1914
2256
|
if (task.stderrText) {
|
|
1915
2257
|
settle(task, new Error(task.stderrText.trim()), void 0);
|
|
1916
2258
|
continue;
|
|
@@ -1926,13 +2268,13 @@ function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
|
1926
2268
|
settle(task, null, void 0);
|
|
1927
2269
|
}
|
|
1928
2270
|
} catch (err) {
|
|
1929
|
-
|
|
1930
|
-
|
|
2271
|
+
_didIteratorError2 = true;
|
|
2272
|
+
_iteratorError2 = err;
|
|
1931
2273
|
} finally{
|
|
1932
2274
|
try {
|
|
1933
|
-
if (!
|
|
2275
|
+
if (!_iteratorNormalCompletion2 && null != _iterator2["return"]) _iterator2["return"]();
|
|
1934
2276
|
} finally{
|
|
1935
|
-
if (
|
|
2277
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
1936
2278
|
}
|
|
1937
2279
|
}
|
|
1938
2280
|
tasks.clear();
|
|
@@ -1944,13 +2286,292 @@ function prepareTaskTimeout(task, metrics) {
|
|
|
1944
2286
|
null == metrics || metrics.incrementTasksTimeout();
|
|
1945
2287
|
return createTimeoutError(task.timeout, task.sql);
|
|
1946
2288
|
}
|
|
1947
|
-
function
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
2289
|
+
function createSweeper(param) {
|
|
2290
|
+
var inflight = param.inflight, sweepIntervalMs = param.sweepIntervalMs, handleTaskTimeout = param.handleTaskTimeout;
|
|
2291
|
+
var sweepTimer = null;
|
|
2292
|
+
var schedule = function() {
|
|
2293
|
+
if (sweepTimer) return;
|
|
2294
|
+
sweepTimer = setTimeout(function() {
|
|
2295
|
+
sweepTimer = null;
|
|
2296
|
+
var now = performance.now();
|
|
2297
|
+
inflight.forEach(function(task) {
|
|
2298
|
+
if (now - task.startTime > task.timeout) handleTaskTimeout(task);
|
|
2299
|
+
});
|
|
2300
|
+
if (inflight.count > 0) schedule();
|
|
2301
|
+
}, sweepIntervalMs).unref();
|
|
2302
|
+
};
|
|
2303
|
+
var clear = function() {
|
|
2304
|
+
clearTimeout(sweepTimer);
|
|
2305
|
+
sweepTimer = null;
|
|
2306
|
+
};
|
|
2307
|
+
return {
|
|
2308
|
+
schedule: schedule,
|
|
2309
|
+
clear: clear,
|
|
2310
|
+
getSweepTimer: function() {
|
|
2311
|
+
return sweepTimer;
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
1951
2314
|
}
|
|
1952
|
-
function
|
|
1953
|
-
|
|
2315
|
+
function createFinalizeScheduler(param) {
|
|
2316
|
+
var pendingFinalizeTasks = param.pendingFinalizeTasks, settle = param.settleTask, pumpQueue = param.pumpQueue, pendingStderr = param.pendingStderr, inflight = param.inflight;
|
|
2317
|
+
var scheduled = false;
|
|
2318
|
+
var immediate = null;
|
|
2319
|
+
var cancelled = false;
|
|
2320
|
+
var cancel = function() {
|
|
2321
|
+
cancelled = true;
|
|
2322
|
+
if (immediate) {
|
|
2323
|
+
clearImmediate(immediate);
|
|
2324
|
+
immediate = null;
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
var check = function() {
|
|
2328
|
+
if (cancelled) return;
|
|
2329
|
+
if (scheduled) return;
|
|
2330
|
+
if (0 === pendingFinalizeTasks.size) return;
|
|
2331
|
+
scheduled = true;
|
|
2332
|
+
immediate = setImmediate(function() {
|
|
2333
|
+
immediate = null;
|
|
2334
|
+
if (cancelled) return;
|
|
2335
|
+
finalizePendingTasks(pendingFinalizeTasks, settle, pumpQueue, pendingStderr, inflight);
|
|
2336
|
+
scheduled = false;
|
|
2337
|
+
});
|
|
2338
|
+
};
|
|
2339
|
+
check.cancel = cancel;
|
|
2340
|
+
return check;
|
|
2341
|
+
}
|
|
2342
|
+
function handleParsedValue(raw, inflight, param) {
|
|
2343
|
+
var afterSentinel = param.afterSentinel, rejectAll = param.rejectAll;
|
|
2344
|
+
var task = inflight.first;
|
|
2345
|
+
if (!task) return;
|
|
2346
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
2347
|
+
inflight.shift();
|
|
2348
|
+
afterSentinel(task);
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
if ("[]" === raw) return;
|
|
2352
|
+
var parsed;
|
|
2353
|
+
try {
|
|
2354
|
+
parsed = JSON.parse(raw);
|
|
2355
|
+
} catch (error) {
|
|
2356
|
+
rejectAll(new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2359
|
+
if (isSentinelRow(parsed, task.token)) {
|
|
2360
|
+
inflight.shift();
|
|
2361
|
+
afterSentinel(task);
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
if (task.timedout) return;
|
|
2365
|
+
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
2366
|
+
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
2367
|
+
}
|
|
2368
|
+
function createPumpQueue(param) {
|
|
2369
|
+
var queue = param.queue, inflight = param.inflight, processManager = param.processManager, sweeper = param.sweeper, batchSize = param.batchSize, maxInflight = param.maxInflight;
|
|
2370
|
+
var nextBatchId = 1;
|
|
2371
|
+
return function pump() {
|
|
2372
|
+
var _inflight;
|
|
2373
|
+
if (processManager.draining) return void processManager.onDrained(function() {
|
|
2374
|
+
return pump();
|
|
2375
|
+
});
|
|
2376
|
+
if (inflight.count >= maxInflight) return;
|
|
2377
|
+
var batch = [];
|
|
2378
|
+
while(batch.length < batchSize && !queue.isEmpty() && inflight.count + batch.length < maxInflight){
|
|
2379
|
+
var task = queue.peek();
|
|
2380
|
+
if ("stream" === task.kind && (batch.length > 0 || inflight.count > 0)) break;
|
|
2381
|
+
queue.dequeue();
|
|
2382
|
+
batch.push(task);
|
|
2383
|
+
}
|
|
2384
|
+
if (0 === batch.length) return;
|
|
2385
|
+
var now = performance.now();
|
|
2386
|
+
var payload = buildBatchPayload(batch);
|
|
2387
|
+
var batchId = nextBatchId++;
|
|
2388
|
+
var useWalBatch = payload.startsWith("BEGIN;");
|
|
2389
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2390
|
+
try {
|
|
2391
|
+
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2392
|
+
var task1 = _step.value;
|
|
2393
|
+
task1.startTime = now;
|
|
2394
|
+
task1.batchId = batchId;
|
|
2395
|
+
task1.walBatch = useWalBatch;
|
|
2396
|
+
}
|
|
2397
|
+
} catch (err) {
|
|
2398
|
+
_didIteratorError = true;
|
|
2399
|
+
_iteratorError = err;
|
|
2400
|
+
} finally{
|
|
2401
|
+
try {
|
|
2402
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2403
|
+
} finally{
|
|
2404
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
(_inflight = inflight).push.apply(_inflight, pipelineUtils_to_consumable_array(batch));
|
|
2408
|
+
sweeper.schedule();
|
|
2409
|
+
processManager.write(payload);
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
function handleSentinelTask(task, param) {
|
|
2413
|
+
var settleTask = param.settleTask, pendingFinalizeTasks = param.pendingFinalizeTasks, scheduleFinalizeCheck = param.scheduleFinalizeCheck, pumpQueue = param.pumpQueue;
|
|
2414
|
+
if (task.timedout) return void pumpQueue();
|
|
2415
|
+
if (task.consumerError) {
|
|
2416
|
+
settleTask(task, task.consumerError, void 0);
|
|
2417
|
+
pumpQueue();
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
pendingFinalizeTasks.add(task);
|
|
2421
|
+
scheduleFinalizeCheck();
|
|
2422
|
+
pumpQueue();
|
|
2423
|
+
}
|
|
2424
|
+
function handleStderrChunk(chunk, param) {
|
|
2425
|
+
var inflight = param.inflight, pendingFinalizeTasks = param.pendingFinalizeTasks, logger = param.logger, pendingStderr = param.pendingStderr;
|
|
2426
|
+
var inflightFirst = inflight.first;
|
|
2427
|
+
var firstPending = pendingFinalizeTasks.values().next().value;
|
|
2428
|
+
var zeroRowMatch = false;
|
|
2429
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2430
|
+
try {
|
|
2431
|
+
for(var _iterator = pendingFinalizeTasks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2432
|
+
var t = _step.value;
|
|
2433
|
+
if ("query" === t.kind && 0 === t.rows.length) {
|
|
2434
|
+
t.stderrText += chunk;
|
|
2435
|
+
zeroRowMatch = true;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
} catch (err) {
|
|
2439
|
+
_didIteratorError = true;
|
|
2440
|
+
_iteratorError = err;
|
|
2441
|
+
} finally{
|
|
2442
|
+
try {
|
|
2443
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2444
|
+
} finally{
|
|
2445
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
if (zeroRowMatch) return;
|
|
2449
|
+
var task = null != inflightFirst ? inflightFirst : firstPending;
|
|
2450
|
+
if (!task) {
|
|
2451
|
+
var _logger_error;
|
|
2452
|
+
null == logger || null == (_logger_error = logger.error) || _logger_error.call(logger, chunk.trim());
|
|
2453
|
+
return;
|
|
2454
|
+
}
|
|
2455
|
+
if (null == task.batchId) {
|
|
2456
|
+
task.stderrText += chunk;
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
if (task.walBatch) {
|
|
2460
|
+
task.stderrText += chunk;
|
|
2461
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2462
|
+
try {
|
|
2463
|
+
for(var _iterator1 = pendingFinalizeTasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2464
|
+
var t1 = _step1.value;
|
|
2465
|
+
if (t1 !== task) t1.stderrText += chunk;
|
|
2466
|
+
}
|
|
2467
|
+
} catch (err) {
|
|
2468
|
+
_didIteratorError1 = true;
|
|
2469
|
+
_iteratorError1 = err;
|
|
2470
|
+
} finally{
|
|
2471
|
+
try {
|
|
2472
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2473
|
+
} finally{
|
|
2474
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
inflight.forEach(function(t) {
|
|
2478
|
+
if (t !== task) t.stderrText += chunk;
|
|
2479
|
+
});
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
if (task === inflightFirst) {
|
|
2483
|
+
if (inflight.count > 1) null == pendingStderr || pendingStderr.push(chunk);
|
|
2484
|
+
else if (pendingFinalizeTasks.size > 0) {
|
|
2485
|
+
var hasZeroRowQuery = false;
|
|
2486
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
2487
|
+
try {
|
|
2488
|
+
for(var _iterator2 = pendingFinalizeTasks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2489
|
+
var t2 = _step2.value;
|
|
2490
|
+
if ("query" === t2.kind && 0 === t2.rows.length) {
|
|
2491
|
+
hasZeroRowQuery = true;
|
|
2492
|
+
break;
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
} catch (err) {
|
|
2496
|
+
_didIteratorError2 = true;
|
|
2497
|
+
_iteratorError2 = err;
|
|
2498
|
+
} finally{
|
|
2499
|
+
try {
|
|
2500
|
+
if (!_iteratorNormalCompletion2 && null != _iterator2["return"]) _iterator2["return"]();
|
|
2501
|
+
} finally{
|
|
2502
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
if (hasZeroRowQuery) null == pendingStderr || pendingStderr.push(chunk);
|
|
2506
|
+
else if ("query" === task.kind && task.rows.length > 0) {
|
|
2507
|
+
var _logger_error1;
|
|
2508
|
+
null == logger || null == (_logger_error1 = logger.error) || _logger_error1.call(logger, chunk.trim());
|
|
2509
|
+
} else task.stderrText += chunk;
|
|
2510
|
+
} else if ("query" === task.kind && task.rows.length > 0) {
|
|
2511
|
+
var _logger_error2;
|
|
2512
|
+
null == logger || null == (_logger_error2 = logger.error) || _logger_error2.call(logger, chunk.trim());
|
|
2513
|
+
} else task.stderrText += chunk;
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
|
|
2517
|
+
try {
|
|
2518
|
+
for(var _iterator3 = pendingFinalizeTasks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
2519
|
+
var t3 = _step3.value;
|
|
2520
|
+
t3.stderrText += chunk;
|
|
2521
|
+
}
|
|
2522
|
+
} catch (err) {
|
|
2523
|
+
_didIteratorError3 = true;
|
|
2524
|
+
_iteratorError3 = err;
|
|
2525
|
+
} finally{
|
|
2526
|
+
try {
|
|
2527
|
+
if (!_iteratorNormalCompletion3 && null != _iterator3["return"]) _iterator3["return"]();
|
|
2528
|
+
} finally{
|
|
2529
|
+
if (_didIteratorError3) throw _iteratorError3;
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
function rejectAllTasks(param) {
|
|
2534
|
+
var inflight = param.inflight, queue = param.queue, pendingFinalizeTasks = param.pendingFinalizeTasks, settleTask = param.settleTask, error = param.error;
|
|
2535
|
+
var all = inflight.toArray();
|
|
2536
|
+
inflight.clear();
|
|
2537
|
+
var queued = queue.dequeue();
|
|
2538
|
+
while(queued){
|
|
2539
|
+
settleTask(queued, error, void 0);
|
|
2540
|
+
queued = queue.dequeue();
|
|
2541
|
+
}
|
|
2542
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2543
|
+
try {
|
|
2544
|
+
for(var _iterator = all[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2545
|
+
var task = _step.value;
|
|
2546
|
+
settleTask(task, error, void 0);
|
|
2547
|
+
}
|
|
2548
|
+
} catch (err) {
|
|
2549
|
+
_didIteratorError = true;
|
|
2550
|
+
_iteratorError = err;
|
|
2551
|
+
} finally{
|
|
2552
|
+
try {
|
|
2553
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2554
|
+
} finally{
|
|
2555
|
+
if (_didIteratorError) throw _iteratorError;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2559
|
+
try {
|
|
2560
|
+
for(var _iterator1 = pendingFinalizeTasks[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2561
|
+
var task1 = _step1.value;
|
|
2562
|
+
settleTask(task1, error, void 0);
|
|
2563
|
+
}
|
|
2564
|
+
} catch (err) {
|
|
2565
|
+
_didIteratorError1 = true;
|
|
2566
|
+
_iteratorError1 = err;
|
|
2567
|
+
} finally{
|
|
2568
|
+
try {
|
|
2569
|
+
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2570
|
+
} finally{
|
|
2571
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
pendingFinalizeTasks.clear();
|
|
1954
2575
|
}
|
|
1955
2576
|
function taskWorker_check_private_redeclaration(obj, privateCollection) {
|
|
1956
2577
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -1966,22 +2587,6 @@ function taskWorker_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
1966
2587
|
descriptor.value = value;
|
|
1967
2588
|
}
|
|
1968
2589
|
}
|
|
1969
|
-
function taskWorker_class_apply_descriptor_update(receiver, descriptor) {
|
|
1970
|
-
if (descriptor.set) {
|
|
1971
|
-
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1972
|
-
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
1973
|
-
set value (v){
|
|
1974
|
-
descriptor.set.call(receiver, v);
|
|
1975
|
-
},
|
|
1976
|
-
get value () {
|
|
1977
|
-
return descriptor.get.call(receiver);
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
|
-
return descriptor.__destrWrapper;
|
|
1981
|
-
}
|
|
1982
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
1983
|
-
return descriptor;
|
|
1984
|
-
}
|
|
1985
2590
|
function taskWorker_class_call_check(instance, Constructor) {
|
|
1986
2591
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1987
2592
|
}
|
|
@@ -2002,10 +2607,6 @@ function taskWorker_class_private_field_set(receiver, privateMap, value) {
|
|
|
2002
2607
|
taskWorker_class_apply_descriptor_set(receiver, descriptor, value);
|
|
2003
2608
|
return value;
|
|
2004
2609
|
}
|
|
2005
|
-
function taskWorker_class_private_field_update(receiver, privateMap) {
|
|
2006
|
-
var descriptor = taskWorker_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
2007
|
-
return taskWorker_class_apply_descriptor_update(receiver, descriptor);
|
|
2008
|
-
}
|
|
2009
2610
|
function taskWorker_class_private_method_get(receiver, privateSet, fn) {
|
|
2010
2611
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
2011
2612
|
return fn;
|
|
@@ -2028,24 +2629,7 @@ function taskWorker_create_class(Constructor, protoProps, staticProps) {
|
|
|
2028
2629
|
if (staticProps) taskWorker_defineProperties(Constructor, staticProps);
|
|
2029
2630
|
return Constructor;
|
|
2030
2631
|
}
|
|
2031
|
-
|
|
2032
|
-
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
2033
|
-
}
|
|
2034
|
-
function _non_iterable_spread() {
|
|
2035
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2036
|
-
}
|
|
2037
|
-
function _to_consumable_array(arr) {
|
|
2038
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
2039
|
-
}
|
|
2040
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
2041
|
-
if (!o) return;
|
|
2042
|
-
if ("string" == typeof o) return _array_like_to_array(o, minLen);
|
|
2043
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2044
|
-
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
2045
|
-
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
2046
|
-
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
2047
|
-
}
|
|
2048
|
-
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();
|
|
2632
|
+
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();
|
|
2049
2633
|
var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
2050
2634
|
"use strict";
|
|
2051
2635
|
function TaskWorker(param) {
|
|
@@ -2053,15 +2637,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2053
2637
|
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;
|
|
2054
2638
|
taskWorker_class_call_check(this, TaskWorker);
|
|
2055
2639
|
taskWorker_class_private_method_init(this, _startProcess);
|
|
2056
|
-
taskWorker_class_private_method_init(this, _inflightCount);
|
|
2057
|
-
taskWorker_class_private_method_init(this, _firstInflight);
|
|
2058
|
-
taskWorker_class_private_method_init(this, _shiftInflight);
|
|
2059
2640
|
taskWorker_class_private_method_init(this, _pumpQueue);
|
|
2060
|
-
taskWorker_class_private_method_init(this,
|
|
2061
|
-
taskWorker_class_private_method_init(this, _scheduleFinalizeCheck);
|
|
2641
|
+
taskWorker_class_private_method_init(this, _afterSentinel);
|
|
2062
2642
|
taskWorker_class_private_method_init(this, _handleStderrChunk);
|
|
2063
|
-
taskWorker_class_private_method_init(this, _scheduleSweep);
|
|
2064
|
-
taskWorker_class_private_method_init(this, _handleTaskTimeout);
|
|
2065
2643
|
taskWorker_class_private_method_init(this, _settleTask);
|
|
2066
2644
|
taskWorker_class_private_method_init(this, _rejectAll);
|
|
2067
2645
|
taskWorker_class_private_field_init(this, _processManager, {
|
|
@@ -2072,22 +2650,14 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2072
2650
|
writable: true,
|
|
2073
2651
|
value: new queue_Queue()
|
|
2074
2652
|
});
|
|
2075
|
-
taskWorker_class_private_field_init(this,
|
|
2076
|
-
writable: true,
|
|
2077
|
-
value: []
|
|
2078
|
-
});
|
|
2079
|
-
taskWorker_class_private_field_init(this, _inflightHead, {
|
|
2653
|
+
taskWorker_class_private_field_init(this, taskWorker_inflight, {
|
|
2080
2654
|
writable: true,
|
|
2081
|
-
value:
|
|
2655
|
+
value: new inflightTracker_InflightTracker()
|
|
2082
2656
|
});
|
|
2083
2657
|
taskWorker_class_private_field_init(this, _pendingFinalizeTasks, {
|
|
2084
2658
|
writable: true,
|
|
2085
2659
|
value: new Set()
|
|
2086
2660
|
});
|
|
2087
|
-
taskWorker_class_private_field_init(this, _scheduledFinalize, {
|
|
2088
|
-
writable: true,
|
|
2089
|
-
value: false
|
|
2090
|
-
});
|
|
2091
2661
|
taskWorker_class_private_field_init(this, _valueParser, {
|
|
2092
2662
|
writable: true,
|
|
2093
2663
|
value: void 0
|
|
@@ -2116,31 +2686,72 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2116
2686
|
writable: true,
|
|
2117
2687
|
value: void 0
|
|
2118
2688
|
});
|
|
2119
|
-
taskWorker_class_private_field_init(this,
|
|
2689
|
+
taskWorker_class_private_field_init(this, _sweeper, {
|
|
2120
2690
|
writable: true,
|
|
2121
|
-
value:
|
|
2691
|
+
value: void 0
|
|
2692
|
+
});
|
|
2693
|
+
taskWorker_class_private_field_init(this, _scheduleFinalizeCheck, {
|
|
2694
|
+
writable: true,
|
|
2695
|
+
value: void 0
|
|
2122
2696
|
});
|
|
2123
|
-
taskWorker_class_private_field_init(this,
|
|
2697
|
+
taskWorker_class_private_field_init(this, _pump, {
|
|
2124
2698
|
writable: true,
|
|
2125
2699
|
value: void 0
|
|
2126
2700
|
});
|
|
2701
|
+
taskWorker_class_private_field_init(this, _pendingStderr, {
|
|
2702
|
+
writable: true,
|
|
2703
|
+
value: []
|
|
2704
|
+
});
|
|
2127
2705
|
taskWorker_class_private_field_set(this, _name, null != name ? name : "worker");
|
|
2128
2706
|
taskWorker_class_private_field_set(this, _statementTimeout, statementTimeout);
|
|
2129
2707
|
taskWorker_class_private_field_set(this, _logger, logger);
|
|
2130
2708
|
taskWorker_class_private_field_set(this, _batchSize, batchSize);
|
|
2131
2709
|
taskWorker_class_private_field_set(this, _maxInflight, maxInflight);
|
|
2132
2710
|
taskWorker_class_private_field_set(this, _metrics, metrics);
|
|
2133
|
-
taskWorker_class_private_field_set(this, _sweepIntervalMs, sweepInterval);
|
|
2134
2711
|
taskWorker_class_private_field_set(this, _processManager, new process_ProcessManager({
|
|
2135
2712
|
binary: binary,
|
|
2136
2713
|
database: database,
|
|
2137
|
-
initMode: initMode
|
|
2138
|
-
|
|
2139
|
-
|
|
2714
|
+
initMode: initMode
|
|
2715
|
+
}));
|
|
2716
|
+
taskWorker_class_private_field_get(this, _processManager).setOnDrainCallback(function() {
|
|
2717
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2718
|
+
});
|
|
2719
|
+
taskWorker_class_private_field_set(this, _sweeper, createSweeper({
|
|
2720
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2721
|
+
sweepIntervalMs: sweepInterval,
|
|
2722
|
+
handleTaskTimeout: function(task) {
|
|
2723
|
+
var error = prepareTaskTimeout(task, taskWorker_class_private_field_get(_this, _metrics));
|
|
2724
|
+
if (error) taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, error, void 0);
|
|
2140
2725
|
}
|
|
2141
2726
|
}));
|
|
2727
|
+
taskWorker_class_private_field_set(this, _pump, createPumpQueue({
|
|
2728
|
+
queue: taskWorker_class_private_field_get(this, _pendingQueue),
|
|
2729
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2730
|
+
processManager: taskWorker_class_private_field_get(this, _processManager),
|
|
2731
|
+
sweeper: taskWorker_class_private_field_get(this, _sweeper),
|
|
2732
|
+
batchSize: taskWorker_class_private_field_get(this, _batchSize),
|
|
2733
|
+
maxInflight: taskWorker_class_private_field_get(this, _maxInflight)
|
|
2734
|
+
}));
|
|
2735
|
+
taskWorker_class_private_field_set(this, _scheduleFinalizeCheck, createFinalizeScheduler({
|
|
2736
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2737
|
+
settleTask: function(t, e, v1) {
|
|
2738
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2739
|
+
},
|
|
2740
|
+
pumpQueue: function() {
|
|
2741
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2742
|
+
},
|
|
2743
|
+
pendingStderr: taskWorker_class_private_field_get(this, _pendingStderr),
|
|
2744
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight)
|
|
2745
|
+
}));
|
|
2142
2746
|
taskWorker_class_private_field_set(this, _valueParser, createJsonValueParser(function(raw) {
|
|
2143
|
-
|
|
2747
|
+
handleParsedValue(raw, taskWorker_class_private_field_get(_this, taskWorker_inflight), {
|
|
2748
|
+
afterSentinel: function(task) {
|
|
2749
|
+
return taskWorker_class_private_method_get(_this, _afterSentinel, taskWorker_afterSentinel).call(_this, task);
|
|
2750
|
+
},
|
|
2751
|
+
rejectAll: function(error) {
|
|
2752
|
+
return taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, error);
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2144
2755
|
}));
|
|
2145
2756
|
taskWorker_class_private_method_get(this, _startProcess, startProcess).call(this);
|
|
2146
2757
|
}
|
|
@@ -2154,13 +2765,13 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2154
2765
|
{
|
|
2155
2766
|
key: "idle",
|
|
2156
2767
|
get: function() {
|
|
2157
|
-
return
|
|
2768
|
+
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;
|
|
2158
2769
|
}
|
|
2159
2770
|
},
|
|
2160
2771
|
{
|
|
2161
2772
|
key: "pendingStatements",
|
|
2162
2773
|
get: function() {
|
|
2163
|
-
return taskWorker_class_private_field_get(this, _pendingQueue).size +
|
|
2774
|
+
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;
|
|
2164
2775
|
}
|
|
2165
2776
|
},
|
|
2166
2777
|
{
|
|
@@ -2190,7 +2801,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2190
2801
|
{
|
|
2191
2802
|
key: "_sweepTimer",
|
|
2192
2803
|
get: function() {
|
|
2193
|
-
|
|
2804
|
+
var _$_class_private_field_get;
|
|
2805
|
+
var _class_private_field_get_getSweepTimer;
|
|
2806
|
+
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;
|
|
2194
2807
|
}
|
|
2195
2808
|
},
|
|
2196
2809
|
{
|
|
@@ -2202,8 +2815,9 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2202
2815
|
{
|
|
2203
2816
|
key: "kill",
|
|
2204
2817
|
value: function() {
|
|
2205
|
-
|
|
2206
|
-
|
|
2818
|
+
var _class_private_field_get_cancel, _$_class_private_field_get;
|
|
2819
|
+
taskWorker_class_private_field_get(this, _sweeper).clear();
|
|
2820
|
+
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);
|
|
2207
2821
|
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, new Error("".concat(taskWorker_class_private_field_get(this, _name), " is killed")));
|
|
2208
2822
|
taskWorker_class_private_field_get(this, _processManager).kill();
|
|
2209
2823
|
}
|
|
@@ -2218,7 +2832,7 @@ function startProcess() {
|
|
|
2218
2832
|
taskWorker_class_private_field_get(_this, _valueParser).feed(chunk);
|
|
2219
2833
|
});
|
|
2220
2834
|
proc.stderr.on("data", function(chunk) {
|
|
2221
|
-
taskWorker_class_private_method_get(_this, _handleStderrChunk,
|
|
2835
|
+
taskWorker_class_private_method_get(_this, _handleStderrChunk, taskWorker_handleStderrChunk1).call(_this, chunk);
|
|
2222
2836
|
});
|
|
2223
2837
|
proc.on("error", function(error) {
|
|
2224
2838
|
var _class_private_field_get_error, _$_class_private_field_get;
|
|
@@ -2232,200 +2846,47 @@ function startProcess() {
|
|
|
2232
2846
|
taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, err);
|
|
2233
2847
|
});
|
|
2234
2848
|
}
|
|
2235
|
-
function inflightCount() {
|
|
2236
|
-
return taskWorker_class_private_field_get(this, _inflightTasks).length - taskWorker_class_private_field_get(this, _inflightHead);
|
|
2237
|
-
}
|
|
2238
|
-
function firstInflight() {
|
|
2239
|
-
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;
|
|
2240
|
-
}
|
|
2241
|
-
function shiftInflight() {
|
|
2242
|
-
var task = taskWorker_class_private_field_get(this, _inflightTasks)[taskWorker_class_private_field_get(this, _inflightHead)];
|
|
2243
|
-
taskWorker_class_private_field_get(this, _inflightTasks)[taskWorker_class_private_field_get(this, _inflightHead)] = null;
|
|
2244
|
-
taskWorker_class_private_field_update(this, _inflightHead).value++;
|
|
2245
|
-
if (taskWorker_class_private_field_get(this, _inflightHead) >= taskWorker_class_private_field_get(this, _inflightTasks).length) {
|
|
2246
|
-
taskWorker_class_private_field_set(this, _inflightTasks, []);
|
|
2247
|
-
taskWorker_class_private_field_set(this, _inflightHead, 0);
|
|
2248
|
-
} else if (taskWorker_class_private_field_get(this, _inflightHead) > 128) {
|
|
2249
|
-
taskWorker_class_private_field_set(this, _inflightTasks, taskWorker_class_private_field_get(this, _inflightTasks).slice(taskWorker_class_private_field_get(this, _inflightHead)));
|
|
2250
|
-
taskWorker_class_private_field_set(this, _inflightHead, 0);
|
|
2251
|
-
}
|
|
2252
|
-
return task;
|
|
2253
|
-
}
|
|
2254
2849
|
function taskWorker_pumpQueue() {
|
|
2255
|
-
|
|
2256
|
-
if (taskWorker_class_private_field_get(this, _processManager).draining) return;
|
|
2257
|
-
if (taskWorker_class_private_method_get(this, _inflightCount, inflightCount).call(this) >= taskWorker_class_private_field_get(this, _maxInflight)) return;
|
|
2258
|
-
var batch = [];
|
|
2259
|
-
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)){
|
|
2260
|
-
var task = taskWorker_class_private_field_get(this, _pendingQueue).peek();
|
|
2261
|
-
if ("stream" === task.kind && (batch.length > 0 || taskWorker_class_private_method_get(this, _inflightCount, inflightCount).call(this) > 0)) break;
|
|
2262
|
-
taskWorker_class_private_field_get(this, _pendingQueue).dequeue();
|
|
2263
|
-
batch.push(task);
|
|
2264
|
-
}
|
|
2265
|
-
if (0 === batch.length) return;
|
|
2266
|
-
var now = performance.now();
|
|
2267
|
-
var payload = buildBatchPayload(batch);
|
|
2268
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2269
|
-
try {
|
|
2270
|
-
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2271
|
-
var task1 = _step.value;
|
|
2272
|
-
task1.startTime = now;
|
|
2273
|
-
}
|
|
2274
|
-
} catch (err) {
|
|
2275
|
-
_didIteratorError = true;
|
|
2276
|
-
_iteratorError = err;
|
|
2277
|
-
} finally{
|
|
2278
|
-
try {
|
|
2279
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2280
|
-
} finally{
|
|
2281
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
(_$_class_private_field_get = taskWorker_class_private_field_get(this, _inflightTasks)).push.apply(_$_class_private_field_get, _to_consumable_array(batch));
|
|
2285
|
-
taskWorker_class_private_method_get(this, _scheduleSweep, scheduleSweep).call(this);
|
|
2286
|
-
taskWorker_class_private_field_get(this, _processManager).write(payload);
|
|
2287
|
-
}
|
|
2288
|
-
function handleParsedValue(raw) {
|
|
2289
|
-
var task = taskWorker_class_private_method_get(this, _firstInflight, firstInflight).call(this);
|
|
2290
|
-
if (!task) return;
|
|
2291
|
-
if (isSentinelRaw(raw, task.token)) {
|
|
2292
|
-
taskWorker_class_private_method_get(this, _shiftInflight, shiftInflight).call(this);
|
|
2293
|
-
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2294
|
-
if (task.stderrText) {
|
|
2295
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2296
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2297
|
-
return;
|
|
2298
|
-
}
|
|
2299
|
-
if (task.consumerError) {
|
|
2300
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2301
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2302
|
-
return;
|
|
2303
|
-
}
|
|
2304
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2305
|
-
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2306
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
if ("[]" === raw) return;
|
|
2310
|
-
var parsed;
|
|
2311
|
-
try {
|
|
2312
|
-
parsed = JSON.parse(raw);
|
|
2313
|
-
} catch (error) {
|
|
2314
|
-
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
2315
|
-
return;
|
|
2316
|
-
}
|
|
2317
|
-
if (isSentinelRow(parsed, task.token)) {
|
|
2318
|
-
taskWorker_class_private_method_get(this, _shiftInflight, shiftInflight).call(this);
|
|
2319
|
-
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2320
|
-
if (task.stderrText) {
|
|
2321
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2322
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2323
|
-
return;
|
|
2324
|
-
}
|
|
2325
|
-
if (task.consumerError) {
|
|
2326
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2327
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2331
|
-
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2332
|
-
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2333
|
-
return;
|
|
2334
|
-
}
|
|
2335
|
-
if (task.timedout) return;
|
|
2336
|
-
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
2337
|
-
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
2850
|
+
taskWorker_class_private_field_get(this, _pump).call(this);
|
|
2338
2851
|
}
|
|
2339
|
-
function
|
|
2852
|
+
function taskWorker_afterSentinel(task) {
|
|
2340
2853
|
var _this = this;
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
setImmediate(function() {
|
|
2344
|
-
taskWorker_class_private_field_set(_this, _scheduledFinalize, false);
|
|
2345
|
-
finalizePendingTasks(taskWorker_class_private_field_get(_this, _pendingFinalizeTasks), function(t, e, v1) {
|
|
2854
|
+
handleSentinelTask(task, {
|
|
2855
|
+
settleTask: function(t, e, v1) {
|
|
2346
2856
|
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2347
|
-
},
|
|
2857
|
+
},
|
|
2858
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2859
|
+
scheduleFinalizeCheck: function() {
|
|
2860
|
+
return taskWorker_class_private_field_get(_this, _scheduleFinalizeCheck).call(_this);
|
|
2861
|
+
},
|
|
2862
|
+
pumpQueue: function() {
|
|
2348
2863
|
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2349
|
-
});
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
function taskWorker_handleStderrChunk(chunk) {
|
|
2353
|
-
var _class_private_field_get_values_next_value;
|
|
2354
|
-
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);
|
|
2355
|
-
if (!task) {
|
|
2356
|
-
var _class_private_field_get_error, _$_class_private_field_get;
|
|
2357
|
-
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());
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
2360
|
-
task.stderrText += chunk;
|
|
2361
|
-
}
|
|
2362
|
-
function scheduleSweep() {
|
|
2363
|
-
var _this = this;
|
|
2364
|
-
if (taskWorker_class_private_field_get(this, _sweepTimer)) return;
|
|
2365
|
-
taskWorker_class_private_field_set(this, _sweepTimer, setTimeout(function() {
|
|
2366
|
-
taskWorker_class_private_field_set(_this, _sweepTimer, null);
|
|
2367
|
-
var tasks = taskWorker_class_private_field_get(_this, _inflightTasks);
|
|
2368
|
-
var head = taskWorker_class_private_field_get(_this, _inflightHead);
|
|
2369
|
-
var now = performance.now();
|
|
2370
|
-
for(var i = head; i < tasks.length; i++){
|
|
2371
|
-
var task = tasks[i];
|
|
2372
|
-
if (now - task.startTime > task.timeout) taskWorker_class_private_method_get(_this, _handleTaskTimeout, handleTaskTimeout).call(_this, task);
|
|
2373
2864
|
}
|
|
2374
|
-
|
|
2375
|
-
}, taskWorker_class_private_field_get(this, _sweepIntervalMs)).unref());
|
|
2865
|
+
});
|
|
2376
2866
|
}
|
|
2377
|
-
function
|
|
2378
|
-
|
|
2379
|
-
|
|
2867
|
+
function taskWorker_handleStderrChunk1(chunk) {
|
|
2868
|
+
handleStderrChunk(chunk, {
|
|
2869
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2870
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2871
|
+
logger: taskWorker_class_private_field_get(this, _logger),
|
|
2872
|
+
pendingStderr: taskWorker_class_private_field_get(this, _pendingStderr)
|
|
2873
|
+
});
|
|
2380
2874
|
}
|
|
2381
2875
|
function settleTask1(task, error, value) {
|
|
2382
|
-
|
|
2876
|
+
settleUtils_settleTask(task, error, value, taskWorker_class_private_field_get(this, _metrics));
|
|
2383
2877
|
}
|
|
2384
2878
|
function taskWorker_rejectAll(error) {
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
2397
|
-
try {
|
|
2398
|
-
for(var _iterator = all[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2399
|
-
var task = _step.value;
|
|
2400
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, error, void 0);
|
|
2401
|
-
}
|
|
2402
|
-
} catch (err) {
|
|
2403
|
-
_didIteratorError = true;
|
|
2404
|
-
_iteratorError = err;
|
|
2405
|
-
} finally{
|
|
2406
|
-
try {
|
|
2407
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2408
|
-
} finally{
|
|
2409
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
2413
|
-
try {
|
|
2414
|
-
for(var _iterator1 = taskWorker_class_private_field_get(this, _pendingFinalizeTasks)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2415
|
-
var task1 = _step1.value;
|
|
2416
|
-
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task1, error, void 0);
|
|
2417
|
-
}
|
|
2418
|
-
} catch (err) {
|
|
2419
|
-
_didIteratorError1 = true;
|
|
2420
|
-
_iteratorError1 = err;
|
|
2421
|
-
} finally{
|
|
2422
|
-
try {
|
|
2423
|
-
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
2424
|
-
} finally{
|
|
2425
|
-
if (_didIteratorError1) throw _iteratorError1;
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).clear();
|
|
2879
|
+
var _this = this;
|
|
2880
|
+
taskWorker_class_private_field_get(this, _sweeper).clear();
|
|
2881
|
+
rejectAllTasks({
|
|
2882
|
+
inflight: taskWorker_class_private_field_get(this, taskWorker_inflight),
|
|
2883
|
+
queue: taskWorker_class_private_field_get(this, _pendingQueue),
|
|
2884
|
+
pendingFinalizeTasks: taskWorker_class_private_field_get(this, _pendingFinalizeTasks),
|
|
2885
|
+
settleTask: function(t, e, v1) {
|
|
2886
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2887
|
+
},
|
|
2888
|
+
error: error
|
|
2889
|
+
});
|
|
2429
2890
|
}
|
|
2430
2891
|
function readerPool_check_private_redeclaration(obj, privateCollection) {
|
|
2431
2892
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -2498,7 +2959,7 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2498
2959
|
logger: logger,
|
|
2499
2960
|
metrics: metrics,
|
|
2500
2961
|
name: "reader-".concat(i),
|
|
2501
|
-
initMode: ":memory:" !== database ? "none" : "
|
|
2962
|
+
initMode: ":memory:" !== database ? "none" : "none"
|
|
2502
2963
|
});
|
|
2503
2964
|
readerPool_class_private_field_get(this, _workers).push(worker);
|
|
2504
2965
|
}
|
|
@@ -2779,6 +3240,10 @@ var metrics_Metrics = /*#__PURE__*/ function() {
|
|
|
2779
3240
|
key: "snapshot",
|
|
2780
3241
|
value: function() {
|
|
2781
3242
|
var elapsed = (Date.now() - metrics_class_private_field_get(this, _startTime)) / 1000;
|
|
3243
|
+
var avgTaskDuration;
|
|
3244
|
+
avgTaskDuration = metrics_class_private_field_get(this, _tasksSuccess) > 0 ? metrics_class_private_field_get(this, _totalDuration) / metrics_class_private_field_get(this, _tasksSuccess) : 0;
|
|
3245
|
+
var throughput;
|
|
3246
|
+
throughput = elapsed > 0 ? metrics_class_private_field_get(this, _tasksTotal) / elapsed : 0;
|
|
2782
3247
|
return {
|
|
2783
3248
|
tasksTotal: metrics_class_private_field_get(this, _tasksTotal),
|
|
2784
3249
|
tasksSuccess: metrics_class_private_field_get(this, _tasksSuccess),
|
|
@@ -2788,8 +3253,8 @@ var metrics_Metrics = /*#__PURE__*/ function() {
|
|
|
2788
3253
|
executeCount: metrics_class_private_field_get(this, _executeCount),
|
|
2789
3254
|
queryCount: metrics_class_private_field_get(this, _queryCount),
|
|
2790
3255
|
streamCount: metrics_class_private_field_get(this, _streamCount),
|
|
2791
|
-
|
|
2792
|
-
|
|
3256
|
+
avgTaskDuration: avgTaskDuration,
|
|
3257
|
+
throughput: throughput,
|
|
2793
3258
|
uptime: elapsed
|
|
2794
3259
|
};
|
|
2795
3260
|
}
|
|
@@ -3063,7 +3528,7 @@ var transactionScope_TransactionScope = /*#__PURE__*/ function() {
|
|
|
3063
3528
|
value: function(error) {
|
|
3064
3529
|
var task = transactionScope_class_private_field_get(this, _deferredQueue).dequeue();
|
|
3065
3530
|
while(task){
|
|
3066
|
-
|
|
3531
|
+
settleUtils_settleTask(task, error, void 0, null);
|
|
3067
3532
|
task = transactionScope_class_private_field_get(this, _deferredQueue).dequeue();
|
|
3068
3533
|
}
|
|
3069
3534
|
}
|
|
@@ -3071,14 +3536,6 @@ var transactionScope_TransactionScope = /*#__PURE__*/ function() {
|
|
|
3071
3536
|
]);
|
|
3072
3537
|
return TransactionScope;
|
|
3073
3538
|
}();
|
|
3074
|
-
function pipelineEngine_array_like_to_array(arr, len) {
|
|
3075
|
-
if (null == len || len > arr.length) len = arr.length;
|
|
3076
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3077
|
-
return arr2;
|
|
3078
|
-
}
|
|
3079
|
-
function pipelineEngine_array_without_holes(arr) {
|
|
3080
|
-
if (Array.isArray(arr)) return pipelineEngine_array_like_to_array(arr);
|
|
3081
|
-
}
|
|
3082
3539
|
function pipelineEngine_check_private_redeclaration(obj, privateCollection) {
|
|
3083
3540
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3084
3541
|
}
|
|
@@ -3093,22 +3550,6 @@ function pipelineEngine_class_apply_descriptor_set(receiver, descriptor, value)
|
|
|
3093
3550
|
descriptor.value = value;
|
|
3094
3551
|
}
|
|
3095
3552
|
}
|
|
3096
|
-
function pipelineEngine_class_apply_descriptor_update(receiver, descriptor) {
|
|
3097
|
-
if (descriptor.set) {
|
|
3098
|
-
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
3099
|
-
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
3100
|
-
set value (v){
|
|
3101
|
-
descriptor.set.call(receiver, v);
|
|
3102
|
-
},
|
|
3103
|
-
get value () {
|
|
3104
|
-
return descriptor.get.call(receiver);
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
return descriptor.__destrWrapper;
|
|
3108
|
-
}
|
|
3109
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
3110
|
-
return descriptor;
|
|
3111
|
-
}
|
|
3112
3553
|
function pipelineEngine_class_call_check(instance, Constructor) {
|
|
3113
3554
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3114
3555
|
}
|
|
@@ -3129,10 +3570,6 @@ function pipelineEngine_class_private_field_set(receiver, privateMap, value) {
|
|
|
3129
3570
|
pipelineEngine_class_apply_descriptor_set(receiver, descriptor, value);
|
|
3130
3571
|
return value;
|
|
3131
3572
|
}
|
|
3132
|
-
function pipelineEngine_class_private_field_update(receiver, privateMap) {
|
|
3133
|
-
var descriptor = pipelineEngine_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
3134
|
-
return pipelineEngine_class_apply_descriptor_update(receiver, descriptor);
|
|
3135
|
-
}
|
|
3136
3573
|
function pipelineEngine_class_private_method_get(receiver, privateSet, fn) {
|
|
3137
3574
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
3138
3575
|
return fn;
|
|
@@ -3155,59 +3592,29 @@ function pipelineEngine_create_class(Constructor, protoProps, staticProps) {
|
|
|
3155
3592
|
if (staticProps) pipelineEngine_defineProperties(Constructor, staticProps);
|
|
3156
3593
|
return Constructor;
|
|
3157
3594
|
}
|
|
3158
|
-
|
|
3159
|
-
if ("undefined" != typeof Symbol && null != iter[Symbol.iterator] || null != iter["@@iterator"]) return Array.from(iter);
|
|
3160
|
-
}
|
|
3161
|
-
function pipelineEngine_non_iterable_spread() {
|
|
3162
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3163
|
-
}
|
|
3164
|
-
function pipelineEngine_to_consumable_array(arr) {
|
|
3165
|
-
return pipelineEngine_array_without_holes(arr) || pipelineEngine_iterable_to_array(arr) || pipelineEngine_unsupported_iterable_to_array(arr) || pipelineEngine_non_iterable_spread();
|
|
3166
|
-
}
|
|
3167
|
-
function pipelineEngine_unsupported_iterable_to_array(o, minLen) {
|
|
3168
|
-
if (!o) return;
|
|
3169
|
-
if ("string" == typeof o) return pipelineEngine_array_like_to_array(o, minLen);
|
|
3170
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3171
|
-
if ("Object" === n && o.constructor) n = o.constructor.name;
|
|
3172
|
-
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
3173
|
-
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineEngine_array_like_to_array(o, minLen);
|
|
3174
|
-
}
|
|
3175
|
-
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();
|
|
3595
|
+
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();
|
|
3176
3596
|
var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
3177
3597
|
"use strict";
|
|
3178
3598
|
function PipelineEngine(processManager, param) {
|
|
3179
3599
|
var _this = this;
|
|
3180
3600
|
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;
|
|
3181
3601
|
pipelineEngine_class_call_check(this, PipelineEngine);
|
|
3182
|
-
|
|
3183
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_firstInflight);
|
|
3184
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_shiftInflight);
|
|
3602
|
+
var _this1, _this2;
|
|
3185
3603
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_pumpQueue);
|
|
3186
|
-
pipelineEngine_class_private_method_init(this,
|
|
3187
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_scheduleFinalizeCheck);
|
|
3188
|
-
pipelineEngine_class_private_method_init(this, pipelineEngine_scheduleSweep);
|
|
3189
|
-
pipelineEngine_class_private_method_init(this, core_pipelineEngine_handleTaskTimeout);
|
|
3604
|
+
pipelineEngine_class_private_method_init(this, core_pipelineEngine_afterSentinel);
|
|
3190
3605
|
pipelineEngine_class_private_method_init(this, pipelineEngine_settleTask);
|
|
3191
3606
|
pipelineEngine_class_private_field_init(this, _queue, {
|
|
3192
3607
|
writable: true,
|
|
3193
3608
|
value: new queue_Queue()
|
|
3194
3609
|
});
|
|
3195
|
-
pipelineEngine_class_private_field_init(this,
|
|
3196
|
-
writable: true,
|
|
3197
|
-
value: []
|
|
3198
|
-
});
|
|
3199
|
-
pipelineEngine_class_private_field_init(this, pipelineEngine_inflightHead, {
|
|
3610
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_inflight, {
|
|
3200
3611
|
writable: true,
|
|
3201
|
-
value:
|
|
3612
|
+
value: new inflightTracker_InflightTracker()
|
|
3202
3613
|
});
|
|
3203
3614
|
pipelineEngine_class_private_field_init(this, pipelineEngine_pendingFinalizeTasks, {
|
|
3204
3615
|
writable: true,
|
|
3205
3616
|
value: new Set()
|
|
3206
3617
|
});
|
|
3207
|
-
pipelineEngine_class_private_field_init(this, pipelineEngine_scheduledFinalize, {
|
|
3208
|
-
writable: true,
|
|
3209
|
-
value: false
|
|
3210
|
-
});
|
|
3211
3618
|
pipelineEngine_class_private_field_init(this, _sharedValueParser, {
|
|
3212
3619
|
writable: true,
|
|
3213
3620
|
value: void 0
|
|
@@ -3244,14 +3651,22 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3244
3651
|
writable: true,
|
|
3245
3652
|
value: false
|
|
3246
3653
|
});
|
|
3247
|
-
pipelineEngine_class_private_field_init(this,
|
|
3654
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_sweeper, {
|
|
3248
3655
|
writable: true,
|
|
3249
|
-
value:
|
|
3656
|
+
value: void 0
|
|
3250
3657
|
});
|
|
3251
|
-
pipelineEngine_class_private_field_init(this,
|
|
3658
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_scheduleFinalizeCheck, {
|
|
3252
3659
|
writable: true,
|
|
3253
3660
|
value: void 0
|
|
3254
3661
|
});
|
|
3662
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_pump, {
|
|
3663
|
+
writable: true,
|
|
3664
|
+
value: void 0
|
|
3665
|
+
});
|
|
3666
|
+
pipelineEngine_class_private_field_init(this, pipelineEngine_pendingStderr, {
|
|
3667
|
+
writable: true,
|
|
3668
|
+
value: []
|
|
3669
|
+
});
|
|
3255
3670
|
pipelineEngine_class_private_field_set(this, pipelineEngine_processManager, processManager);
|
|
3256
3671
|
pipelineEngine_class_private_field_set(this, pipelineEngine_metrics, metrics);
|
|
3257
3672
|
pipelineEngine_class_private_field_set(this, pipelineEngine_statementTimeout, statementTimeout);
|
|
@@ -3259,19 +3674,57 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3259
3674
|
pipelineEngine_class_private_field_set(this, pipelineEngine_batchSize, batchSize);
|
|
3260
3675
|
pipelineEngine_class_private_field_set(this, pipelineEngine_maxInflight, maxInflight);
|
|
3261
3676
|
pipelineEngine_class_private_field_set(this, _onTaskTimeout, null != onTaskTimeout ? onTaskTimeout : function() {});
|
|
3677
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_sweeper, createSweeper({
|
|
3678
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3679
|
+
sweepIntervalMs: sweepInterval,
|
|
3680
|
+
handleTaskTimeout: function(task) {
|
|
3681
|
+
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(_this, pipelineEngine_metrics));
|
|
3682
|
+
if (error) {
|
|
3683
|
+
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, error, void 0);
|
|
3684
|
+
null == (_this1 = pipelineEngine_class_private_field_get(_this2 = _this, _onTaskTimeout)) || _this1.call(_this2, task);
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
}));
|
|
3688
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_pump, createPumpQueue({
|
|
3689
|
+
queue: pipelineEngine_class_private_field_get(this, _queue),
|
|
3690
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3691
|
+
processManager: pipelineEngine_class_private_field_get(this, pipelineEngine_processManager),
|
|
3692
|
+
sweeper: pipelineEngine_class_private_field_get(this, pipelineEngine_sweeper),
|
|
3693
|
+
batchSize: pipelineEngine_class_private_field_get(this, pipelineEngine_batchSize),
|
|
3694
|
+
maxInflight: pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)
|
|
3695
|
+
}));
|
|
3696
|
+
pipelineEngine_class_private_field_set(this, pipelineEngine_scheduleFinalizeCheck, createFinalizeScheduler({
|
|
3697
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3698
|
+
settleTask: function(t, e, v1) {
|
|
3699
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3700
|
+
},
|
|
3701
|
+
pumpQueue: function() {
|
|
3702
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3703
|
+
},
|
|
3704
|
+
pendingStderr: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingStderr),
|
|
3705
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight)
|
|
3706
|
+
}));
|
|
3262
3707
|
pipelineEngine_class_private_field_set(this, _sharedValueParser, createJsonValueParser(function(raw) {
|
|
3263
|
-
|
|
3708
|
+
handleParsedValue(raw, pipelineEngine_class_private_field_get(_this, pipelineEngine_inflight), {
|
|
3709
|
+
afterSentinel: function(task) {
|
|
3710
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_afterSentinel, pipelineEngine_afterSentinel).call(_this, task);
|
|
3711
|
+
},
|
|
3712
|
+
rejectAll: function(error) {
|
|
3713
|
+
return _this.rejectAll(error);
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3264
3716
|
}));
|
|
3265
3717
|
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).setOnDrainCallback(function() {
|
|
3266
3718
|
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3267
3719
|
});
|
|
3268
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_sweepIntervalMs, sweepInterval);
|
|
3269
3720
|
}
|
|
3270
3721
|
pipelineEngine_create_class(PipelineEngine, [
|
|
3271
3722
|
{
|
|
3272
3723
|
key: "_sweepTimer",
|
|
3273
3724
|
get: function() {
|
|
3274
|
-
|
|
3725
|
+
var _$_class_private_field_get;
|
|
3726
|
+
var _class_private_field_get_getSweepTimer;
|
|
3727
|
+
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;
|
|
3275
3728
|
}
|
|
3276
3729
|
},
|
|
3277
3730
|
{
|
|
@@ -3289,7 +3742,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3289
3742
|
{
|
|
3290
3743
|
key: "pendingStatements",
|
|
3291
3744
|
get: function() {
|
|
3292
|
-
return pipelineEngine_class_private_field_get(this, _queue).size +
|
|
3745
|
+
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;
|
|
3293
3746
|
}
|
|
3294
3747
|
},
|
|
3295
3748
|
{
|
|
@@ -3322,7 +3775,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3322
3775
|
{
|
|
3323
3776
|
key: "handleStdoutChunk",
|
|
3324
3777
|
value: function(chunk) {
|
|
3325
|
-
var task =
|
|
3778
|
+
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflight).first;
|
|
3326
3779
|
if (!task) return;
|
|
3327
3780
|
if ("stream" === task.kind && task.rowParser && !task.rowParser.finished && !task.timedout) {
|
|
3328
3781
|
var leftover = task.rowParser.feed(chunk);
|
|
@@ -3335,209 +3788,64 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3335
3788
|
{
|
|
3336
3789
|
key: "handleStderrChunk",
|
|
3337
3790
|
value: function(chunk) {
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
}
|
|
3345
|
-
task.stderrText += chunk;
|
|
3791
|
+
handleStderrChunk(chunk, {
|
|
3792
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3793
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3794
|
+
logger: pipelineEngine_class_private_field_get(this, pipelineEngine_logger),
|
|
3795
|
+
pendingStderr: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingStderr)
|
|
3796
|
+
});
|
|
3346
3797
|
}
|
|
3347
3798
|
},
|
|
3348
3799
|
{
|
|
3349
3800
|
key: "rejectAll",
|
|
3350
3801
|
value: function(error) {
|
|
3802
|
+
var _this = this;
|
|
3351
3803
|
pipelineEngine_class_private_field_get(this, _sharedValueParser).reset();
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
}
|
|
3362
|
-
} catch (err) {
|
|
3363
|
-
_didIteratorError = true;
|
|
3364
|
-
_iteratorError = err;
|
|
3365
|
-
} finally{
|
|
3366
|
-
try {
|
|
3367
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3368
|
-
} finally{
|
|
3369
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
var queued = pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3373
|
-
while(queued){
|
|
3374
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, queued, error, void 0);
|
|
3375
|
-
queued = pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3376
|
-
}
|
|
3377
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
3378
|
-
try {
|
|
3379
|
-
for(var _iterator1 = pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3380
|
-
var task1 = _step1.value;
|
|
3381
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task1, error, void 0);
|
|
3382
|
-
}
|
|
3383
|
-
} catch (err) {
|
|
3384
|
-
_didIteratorError1 = true;
|
|
3385
|
-
_iteratorError1 = err;
|
|
3386
|
-
} finally{
|
|
3387
|
-
try {
|
|
3388
|
-
if (!_iteratorNormalCompletion1 && null != _iterator1["return"]) _iterator1["return"]();
|
|
3389
|
-
} finally{
|
|
3390
|
-
if (_didIteratorError1) throw _iteratorError1;
|
|
3391
|
-
}
|
|
3392
|
-
}
|
|
3393
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).clear();
|
|
3804
|
+
rejectAllTasks({
|
|
3805
|
+
inflight: pipelineEngine_class_private_field_get(this, pipelineEngine_inflight),
|
|
3806
|
+
queue: pipelineEngine_class_private_field_get(this, _queue),
|
|
3807
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3808
|
+
settleTask: function(t, e, v1) {
|
|
3809
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3810
|
+
},
|
|
3811
|
+
error: error
|
|
3812
|
+
});
|
|
3394
3813
|
}
|
|
3395
3814
|
},
|
|
3396
3815
|
{
|
|
3397
3816
|
key: "kill",
|
|
3398
3817
|
value: function() {
|
|
3818
|
+
var _class_private_field_get_cancel, _$_class_private_field_get;
|
|
3399
3819
|
pipelineEngine_class_private_field_set(this, _active, false);
|
|
3400
|
-
|
|
3401
|
-
|
|
3820
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_sweeper).clear();
|
|
3821
|
+
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);
|
|
3402
3822
|
this.rejectAll(new Error("PipelineEngine is killed"));
|
|
3403
3823
|
}
|
|
3404
3824
|
}
|
|
3405
3825
|
]);
|
|
3406
3826
|
return PipelineEngine;
|
|
3407
3827
|
}();
|
|
3408
|
-
function core_pipelineEngine_inflightCount() {
|
|
3409
|
-
return pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length - pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead);
|
|
3410
|
-
}
|
|
3411
|
-
function pipelineEngine_firstInflight() {
|
|
3412
|
-
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;
|
|
3413
|
-
}
|
|
3414
|
-
function pipelineEngine_shiftInflight() {
|
|
3415
|
-
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)];
|
|
3416
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead)] = null;
|
|
3417
|
-
pipelineEngine_class_private_field_update(this, pipelineEngine_inflightHead).value++;
|
|
3418
|
-
if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead) >= pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length) {
|
|
3419
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightTasks, []);
|
|
3420
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightHead, 0);
|
|
3421
|
-
} else if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightHead) > 128) {
|
|
3422
|
-
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)));
|
|
3423
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_inflightHead, 0);
|
|
3424
|
-
}
|
|
3425
|
-
return task;
|
|
3426
|
-
}
|
|
3427
3828
|
function pipelineEngine_pumpQueue() {
|
|
3428
|
-
var _$_class_private_field_get;
|
|
3429
3829
|
if (!pipelineEngine_class_private_field_get(this, _active)) return;
|
|
3430
|
-
|
|
3431
|
-
if (pipelineEngine_class_private_method_get(this, pipelineEngine_inflightCount, core_pipelineEngine_inflightCount).call(this) >= pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)) return;
|
|
3432
|
-
var batch = [];
|
|
3433
|
-
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)){
|
|
3434
|
-
var task = pipelineEngine_class_private_field_get(this, _queue).peek();
|
|
3435
|
-
if ("stream" === task.kind && (batch.length > 0 || pipelineEngine_class_private_method_get(this, pipelineEngine_inflightCount, core_pipelineEngine_inflightCount).call(this) > 0)) break;
|
|
3436
|
-
pipelineEngine_class_private_field_get(this, _queue).dequeue();
|
|
3437
|
-
batch.push(task);
|
|
3438
|
-
}
|
|
3439
|
-
if (0 === batch.length) return;
|
|
3440
|
-
var now = performance.now();
|
|
3441
|
-
var payload = buildBatchPayload(batch);
|
|
3442
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
3443
|
-
try {
|
|
3444
|
-
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3445
|
-
var task1 = _step.value;
|
|
3446
|
-
task1.startTime = now;
|
|
3447
|
-
}
|
|
3448
|
-
} catch (err) {
|
|
3449
|
-
_didIteratorError = true;
|
|
3450
|
-
_iteratorError = err;
|
|
3451
|
-
} finally{
|
|
3452
|
-
try {
|
|
3453
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3454
|
-
} finally{
|
|
3455
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3456
|
-
}
|
|
3457
|
-
}
|
|
3458
|
-
(_$_class_private_field_get = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)).push.apply(_$_class_private_field_get, pipelineEngine_to_consumable_array(batch));
|
|
3459
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_scheduleSweep, core_pipelineEngine_scheduleSweep).call(this);
|
|
3460
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).write(payload);
|
|
3461
|
-
}
|
|
3462
|
-
function core_pipelineEngine_handleParsedValue(raw) {
|
|
3463
|
-
var task = pipelineEngine_class_private_method_get(this, core_pipelineEngine_firstInflight, pipelineEngine_firstInflight).call(this);
|
|
3464
|
-
if (!task) return;
|
|
3465
|
-
if (isSentinelRaw(raw, task.token)) {
|
|
3466
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_shiftInflight, pipelineEngine_shiftInflight).call(this);
|
|
3467
|
-
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3468
|
-
if (task.consumerError) {
|
|
3469
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3470
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3471
|
-
return;
|
|
3472
|
-
}
|
|
3473
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3474
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3475
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3476
|
-
return;
|
|
3477
|
-
}
|
|
3478
|
-
if ("[]" === raw) return;
|
|
3479
|
-
var parsed;
|
|
3480
|
-
try {
|
|
3481
|
-
parsed = JSON.parse(raw);
|
|
3482
|
-
} catch (error) {
|
|
3483
|
-
this.rejectAll(new Error("Invalid JSON from sqlite3: ".concat(toError(error).message)));
|
|
3484
|
-
return;
|
|
3485
|
-
}
|
|
3486
|
-
if (isSentinelRow(parsed, task.token)) {
|
|
3487
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_shiftInflight, pipelineEngine_shiftInflight).call(this);
|
|
3488
|
-
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3489
|
-
if (task.consumerError) {
|
|
3490
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3491
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3492
|
-
return;
|
|
3493
|
-
}
|
|
3494
|
-
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3495
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3496
|
-
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3497
|
-
return;
|
|
3498
|
-
}
|
|
3499
|
-
if (task.timedout) return;
|
|
3500
|
-
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
3501
|
-
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
3830
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_pump).call(this);
|
|
3502
3831
|
}
|
|
3503
|
-
function
|
|
3832
|
+
function pipelineEngine_afterSentinel(task) {
|
|
3504
3833
|
var _this = this;
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
setImmediate(function() {
|
|
3508
|
-
pipelineEngine_class_private_field_set(_this, pipelineEngine_scheduledFinalize, false);
|
|
3509
|
-
finalizePendingTasks(pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks), function(t, e, v1) {
|
|
3834
|
+
handleSentinelTask(task, {
|
|
3835
|
+
settleTask: function(t, e, v1) {
|
|
3510
3836
|
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3511
|
-
},
|
|
3837
|
+
},
|
|
3838
|
+
pendingFinalizeTasks: pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks),
|
|
3839
|
+
scheduleFinalizeCheck: function() {
|
|
3840
|
+
return pipelineEngine_class_private_field_get(_this, pipelineEngine_scheduleFinalizeCheck).call(_this);
|
|
3841
|
+
},
|
|
3842
|
+
pumpQueue: function() {
|
|
3512
3843
|
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3513
|
-
});
|
|
3514
|
-
});
|
|
3515
|
-
}
|
|
3516
|
-
function core_pipelineEngine_scheduleSweep() {
|
|
3517
|
-
var _this = this;
|
|
3518
|
-
if (pipelineEngine_class_private_field_get(this, pipelineEngine_sweepTimer)) return;
|
|
3519
|
-
pipelineEngine_class_private_field_set(this, pipelineEngine_sweepTimer, setTimeout(function() {
|
|
3520
|
-
pipelineEngine_class_private_field_set(_this, pipelineEngine_sweepTimer, null);
|
|
3521
|
-
var tasks = pipelineEngine_class_private_field_get(_this, pipelineEngine_inflightTasks);
|
|
3522
|
-
var head = pipelineEngine_class_private_field_get(_this, pipelineEngine_inflightHead);
|
|
3523
|
-
var now = performance.now();
|
|
3524
|
-
for(var i = head; i < tasks.length; i++){
|
|
3525
|
-
var task = tasks[i];
|
|
3526
|
-
if (now - task.startTime > task.timeout) pipelineEngine_class_private_method_get(_this, core_pipelineEngine_handleTaskTimeout, pipelineEngine_handleTaskTimeout).call(_this, task);
|
|
3527
3844
|
}
|
|
3528
|
-
|
|
3529
|
-
}, pipelineEngine_class_private_field_get(this, pipelineEngine_sweepIntervalMs)).unref());
|
|
3530
|
-
}
|
|
3531
|
-
function pipelineEngine_handleTaskTimeout(task) {
|
|
3532
|
-
var _this, _this1;
|
|
3533
|
-
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics));
|
|
3534
|
-
if (error) {
|
|
3535
|
-
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, error, void 0);
|
|
3536
|
-
null == (_this = pipelineEngine_class_private_field_get(_this1 = this, _onTaskTimeout)) || _this.call(_this1, task);
|
|
3537
|
-
}
|
|
3845
|
+
});
|
|
3538
3846
|
}
|
|
3539
3847
|
function pipelineEngine_settleTask1(task, error, value) {
|
|
3540
|
-
|
|
3848
|
+
settleUtils_settleTask(task, error, value, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics), {
|
|
3541
3849
|
resetRowParser: true
|
|
3542
3850
|
});
|
|
3543
3851
|
}
|
|
@@ -4044,31 +4352,6 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
4044
4352
|
case 1:
|
|
4045
4353
|
_state.sent();
|
|
4046
4354
|
executor_class_private_field_get(_this, executor_processManager).kill();
|
|
4047
|
-
_state.label = 2;
|
|
4048
|
-
case 2:
|
|
4049
|
-
_state.trys.push([
|
|
4050
|
-
2,
|
|
4051
|
-
4,
|
|
4052
|
-
,
|
|
4053
|
-
5
|
|
4054
|
-
]);
|
|
4055
|
-
return [
|
|
4056
|
-
4,
|
|
4057
|
-
(0, external_node_events_namespaceObject.once)(executor_class_private_field_get(_this, executor_processManager).process, "close")
|
|
4058
|
-
];
|
|
4059
|
-
case 3:
|
|
4060
|
-
_state.sent();
|
|
4061
|
-
return [
|
|
4062
|
-
3,
|
|
4063
|
-
5
|
|
4064
|
-
];
|
|
4065
|
-
case 4:
|
|
4066
|
-
_state.sent();
|
|
4067
|
-
return [
|
|
4068
|
-
3,
|
|
4069
|
-
5
|
|
4070
|
-
];
|
|
4071
|
-
case 5:
|
|
4072
4355
|
return [
|
|
4073
4356
|
2
|
|
4074
4357
|
];
|