sqlite-executor 4.0.2 → 4.0.4
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/pipelineEngine.d.cts +2 -0
- package/dist/cjs/core/process.d.cts +16 -1
- package/dist/cjs/core/taskWorker.d.cts +6 -0
- package/dist/cjs/index.cjs +248 -116
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/core/pipelineEngine.d.mts +2 -0
- package/dist/esm/core/process.d.mts +16 -1
- package/dist/esm/core/taskWorker.d.mts +6 -0
- package/dist/esm/index.mjs +248 -116
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -188,7 +188,7 @@ function normalizeSQL(sql) {
|
|
|
188
188
|
if (void 0 !== cached) return cached;
|
|
189
189
|
var len = sql.length;
|
|
190
190
|
var needed = len + 1;
|
|
191
|
-
if (_normBuf.length < needed) _normBuf = new Uint16Array(
|
|
191
|
+
if (_normBuf.length < needed) _normBuf = new Uint16Array(needed);
|
|
192
192
|
var outCodes = _normBuf;
|
|
193
193
|
var writePos = 0;
|
|
194
194
|
var pendingSpace = false;
|
|
@@ -294,6 +294,7 @@ function createJsonValueParser(onValue) {
|
|
|
294
294
|
nesting: 0,
|
|
295
295
|
inString: false,
|
|
296
296
|
escaped: false,
|
|
297
|
+
_consumed: 0,
|
|
297
298
|
feed: function(chunk) {
|
|
298
299
|
this.buffer += chunk;
|
|
299
300
|
var consumeUntil = 0;
|
|
@@ -325,6 +326,11 @@ function createJsonValueParser(onValue) {
|
|
|
325
326
|
if (code === CHAR_CLOSE_BRACKET || code === CHAR_CLOSE_BRACE) {
|
|
326
327
|
this.nesting--;
|
|
327
328
|
if (0 === this.nesting) {
|
|
329
|
+
if (index === this.start + 1) {
|
|
330
|
+
this.start = -1;
|
|
331
|
+
consumeUntil = index + 1;
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
328
334
|
var raw = this.buffer.slice(this.start, index + 1);
|
|
329
335
|
this.start = -1;
|
|
330
336
|
onValue(raw);
|
|
@@ -333,12 +339,18 @@ function createJsonValueParser(onValue) {
|
|
|
333
339
|
}
|
|
334
340
|
}
|
|
335
341
|
if (consumeUntil > 0) {
|
|
336
|
-
this.
|
|
337
|
-
this.readPos =
|
|
342
|
+
this._consumed = consumeUntil;
|
|
343
|
+
this.readPos = this._consumed;
|
|
344
|
+
if (this._consumed > 65536) {
|
|
345
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
346
|
+
this.readPos = 0;
|
|
347
|
+
this._consumed = 0;
|
|
348
|
+
}
|
|
338
349
|
} else this.readPos = this.buffer.length;
|
|
339
350
|
},
|
|
340
351
|
reset: function() {
|
|
341
352
|
this.buffer = "";
|
|
353
|
+
this._consumed = 0;
|
|
342
354
|
this.start = -1;
|
|
343
355
|
this.readPos = 0;
|
|
344
356
|
this.nesting = 0;
|
|
@@ -358,6 +370,7 @@ function createRowStreamParser(onRow) {
|
|
|
358
370
|
elementEnd: -1,
|
|
359
371
|
nesting: 0,
|
|
360
372
|
readPos: 0,
|
|
373
|
+
_consumed: 0,
|
|
361
374
|
feed: function(chunk) {
|
|
362
375
|
if (this.finished) return chunk;
|
|
363
376
|
this.buffer += chunk;
|
|
@@ -424,24 +437,38 @@ function createRowStreamParser(onRow) {
|
|
|
424
437
|
var delimiter = this.buffer.charCodeAt(lookAhead);
|
|
425
438
|
if (delimiter === CHAR_COMMA || delimiter === CHAR_CLOSE_BRACKET) {
|
|
426
439
|
onRow(this.buffer.slice(this.elementStart, this.elementEnd));
|
|
427
|
-
this.
|
|
440
|
+
this._consumed = lookAhead + 1;
|
|
428
441
|
this.elementStart = -1;
|
|
429
442
|
this.elementEnd = -1;
|
|
430
443
|
this.nesting = 0;
|
|
431
444
|
if (delimiter === CHAR_CLOSE_BRACKET) {
|
|
432
445
|
this.finished = true;
|
|
433
|
-
var tail = this.buffer;
|
|
446
|
+
var tail = this.buffer.slice(this._consumed);
|
|
434
447
|
this.buffer = "";
|
|
448
|
+
this._consumed = 0;
|
|
435
449
|
this.readPos = 0;
|
|
436
450
|
return tail;
|
|
437
451
|
}
|
|
438
|
-
index =
|
|
452
|
+
index = this._consumed;
|
|
453
|
+
if (this._consumed > 65536) {
|
|
454
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
455
|
+
index = 0;
|
|
456
|
+
this._consumed = 0;
|
|
457
|
+
}
|
|
439
458
|
continue;
|
|
440
459
|
}
|
|
441
460
|
}
|
|
442
461
|
}
|
|
443
462
|
index++;
|
|
444
463
|
}
|
|
464
|
+
if (this._consumed > 0) {
|
|
465
|
+
if (-1 !== this.elementStart) {
|
|
466
|
+
this.elementStart -= this._consumed;
|
|
467
|
+
if (-1 !== this.elementEnd) this.elementEnd -= this._consumed;
|
|
468
|
+
}
|
|
469
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
470
|
+
this._consumed = 0;
|
|
471
|
+
}
|
|
445
472
|
if (this.elementStart > 0) {
|
|
446
473
|
this.buffer = this.buffer.slice(this.elementStart);
|
|
447
474
|
if (-1 !== this.elementEnd) this.elementEnd -= this.elementStart;
|
|
@@ -452,6 +479,7 @@ function createRowStreamParser(onRow) {
|
|
|
452
479
|
},
|
|
453
480
|
reset: function() {
|
|
454
481
|
this.buffer = "";
|
|
482
|
+
this._consumed = 0;
|
|
455
483
|
this.started = false;
|
|
456
484
|
this.finished = false;
|
|
457
485
|
this.inString = false;
|
|
@@ -480,6 +508,22 @@ function stream_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
480
508
|
descriptor.value = value;
|
|
481
509
|
}
|
|
482
510
|
}
|
|
511
|
+
function _class_apply_descriptor_update(receiver, descriptor) {
|
|
512
|
+
if (descriptor.set) {
|
|
513
|
+
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
514
|
+
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
515
|
+
set value (v){
|
|
516
|
+
descriptor.set.call(receiver, v);
|
|
517
|
+
},
|
|
518
|
+
get value () {
|
|
519
|
+
return descriptor.get.call(receiver);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
return descriptor.__destrWrapper;
|
|
523
|
+
}
|
|
524
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
525
|
+
return descriptor;
|
|
526
|
+
}
|
|
483
527
|
function stream_class_call_check(instance, Constructor) {
|
|
484
528
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
485
529
|
}
|
|
@@ -500,6 +544,10 @@ function stream_class_private_field_set(receiver, privateMap, value) {
|
|
|
500
544
|
stream_class_apply_descriptor_set(receiver, descriptor, value);
|
|
501
545
|
return value;
|
|
502
546
|
}
|
|
547
|
+
function _class_private_field_update(receiver, privateMap) {
|
|
548
|
+
var descriptor = stream_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
549
|
+
return _class_apply_descriptor_update(receiver, descriptor);
|
|
550
|
+
}
|
|
503
551
|
function stream_defineProperties(target, props) {
|
|
504
552
|
for(var i = 0; i < props.length; i++){
|
|
505
553
|
var descriptor = props[i];
|
|
@@ -536,7 +584,7 @@ function setupStreamParser(task) {
|
|
|
536
584
|
return parser;
|
|
537
585
|
}
|
|
538
586
|
_computedKey = Symbol.asyncIterator;
|
|
539
|
-
var _buffer = /*#__PURE__*/ new WeakMap(), _done = /*#__PURE__*/ new WeakMap(), _error = /*#__PURE__*/ new WeakMap(), _pending = /*#__PURE__*/ new WeakMap();
|
|
587
|
+
var _buffer = /*#__PURE__*/ new WeakMap(), _index = /*#__PURE__*/ new WeakMap(), _done = /*#__PURE__*/ new WeakMap(), _error = /*#__PURE__*/ new WeakMap(), _pending = /*#__PURE__*/ new WeakMap();
|
|
540
588
|
var _computedKey1 = _computedKey;
|
|
541
589
|
var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
542
590
|
"use strict";
|
|
@@ -546,6 +594,10 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
546
594
|
writable: true,
|
|
547
595
|
value: []
|
|
548
596
|
});
|
|
597
|
+
stream_class_private_field_init(this, _index, {
|
|
598
|
+
writable: true,
|
|
599
|
+
value: 0
|
|
600
|
+
});
|
|
549
601
|
stream_class_private_field_init(this, _done, {
|
|
550
602
|
writable: true,
|
|
551
603
|
value: false
|
|
@@ -563,6 +615,7 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
563
615
|
{
|
|
564
616
|
key: "push",
|
|
565
617
|
value: function(row) {
|
|
618
|
+
if (stream_class_private_field_get(this, _done) || stream_class_private_field_get(this, _error)) return;
|
|
566
619
|
if (stream_class_private_field_get(this, _pending)) {
|
|
567
620
|
var resolve = stream_class_private_field_get(this, _pending).resolve;
|
|
568
621
|
stream_class_private_field_set(this, _pending, null);
|
|
@@ -602,8 +655,8 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
602
655
|
key: "next",
|
|
603
656
|
value: function() {
|
|
604
657
|
var _this = this;
|
|
605
|
-
if (stream_class_private_field_get(this, _buffer).length
|
|
606
|
-
value: stream_class_private_field_get(this, _buffer)
|
|
658
|
+
if (stream_class_private_field_get(this, _index) < stream_class_private_field_get(this, _buffer).length) return Promise.resolve({
|
|
659
|
+
value: stream_class_private_field_get(this, _buffer)[_class_private_field_update(this, _index).value++],
|
|
607
660
|
done: false
|
|
608
661
|
});
|
|
609
662
|
if (stream_class_private_field_get(this, _done)) return Promise.resolve({
|
|
@@ -623,6 +676,8 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
623
676
|
key: "return",
|
|
624
677
|
value: function() {
|
|
625
678
|
stream_class_private_field_set(this, _done, true);
|
|
679
|
+
stream_class_private_field_set(this, _buffer, []);
|
|
680
|
+
stream_class_private_field_set(this, _index, 0);
|
|
626
681
|
if (stream_class_private_field_get(this, _pending)) {
|
|
627
682
|
var resolve = stream_class_private_field_get(this, _pending).resolve;
|
|
628
683
|
stream_class_private_field_set(this, _pending, null);
|
|
@@ -980,11 +1035,11 @@ function _ts_generator(thisArg, body) {
|
|
|
980
1035
|
}
|
|
981
1036
|
}
|
|
982
1037
|
var GRACEFUL_SHUTDOWN_TIMEOUT = 5000;
|
|
983
|
-
var _binary = /*#__PURE__*/ new WeakMap(), _database = /*#__PURE__*/ new WeakMap(), _proc = /*#__PURE__*/ new WeakMap(), _initMode = /*#__PURE__*/ new WeakMap(), _draining = /*#__PURE__*/ new WeakMap();
|
|
1038
|
+
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();
|
|
984
1039
|
var process_ProcessManager = /*#__PURE__*/ function() {
|
|
985
1040
|
"use strict";
|
|
986
1041
|
function ProcessManager() {
|
|
987
|
-
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;
|
|
1042
|
+
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;
|
|
988
1043
|
process_class_call_check(this, ProcessManager);
|
|
989
1044
|
process_class_private_field_init(this, _binary, {
|
|
990
1045
|
writable: true,
|
|
@@ -1006,12 +1061,29 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1006
1061
|
writable: true,
|
|
1007
1062
|
value: false
|
|
1008
1063
|
});
|
|
1064
|
+
process_class_private_field_init(this, _onDrain, {
|
|
1065
|
+
writable: true,
|
|
1066
|
+
value: void 0
|
|
1067
|
+
});
|
|
1009
1068
|
var _which;
|
|
1010
1069
|
process_class_private_field_set(this, _binary, null != (_which = which(binary)) ? _which : binary);
|
|
1011
1070
|
process_class_private_field_set(this, _database, database);
|
|
1012
1071
|
process_class_private_field_set(this, _initMode, initMode);
|
|
1072
|
+
process_class_private_field_set(this, _onDrain, null != onDrain ? onDrain : function() {});
|
|
1013
1073
|
}
|
|
1014
1074
|
process_create_class(ProcessManager, [
|
|
1075
|
+
{
|
|
1076
|
+
key: "draining",
|
|
1077
|
+
get: function() {
|
|
1078
|
+
return process_class_private_field_get(this, _draining);
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
key: "setOnDrainCallback",
|
|
1083
|
+
value: function(fn) {
|
|
1084
|
+
process_class_private_field_set(this, _onDrain, fn);
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1015
1087
|
{
|
|
1016
1088
|
key: "binary",
|
|
1017
1089
|
get: function() {
|
|
@@ -1057,10 +1129,12 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1057
1129
|
var _$_class_private_field_get;
|
|
1058
1130
|
var stream = null == (_$_class_private_field_get = process_class_private_field_get(this, _proc)) ? void 0 : _$_class_private_field_get.stdin;
|
|
1059
1131
|
if (!stream) return;
|
|
1060
|
-
if (
|
|
1132
|
+
if (process_class_private_field_get(this, _draining)) return;
|
|
1133
|
+
if (!stream.write(data)) {
|
|
1061
1134
|
process_class_private_field_set(this, _draining, true);
|
|
1062
1135
|
stream.once("drain", function() {
|
|
1063
1136
|
process_class_private_field_set(_this, _draining, false);
|
|
1137
|
+
process_class_private_field_get(_this, _onDrain).call(_this);
|
|
1064
1138
|
});
|
|
1065
1139
|
}
|
|
1066
1140
|
}
|
|
@@ -1079,7 +1153,7 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1079
1153
|
2
|
|
1080
1154
|
];
|
|
1081
1155
|
timer = setTimeout(function() {
|
|
1082
|
-
|
|
1156
|
+
proc.kill();
|
|
1083
1157
|
}, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
1084
1158
|
_state.label = 1;
|
|
1085
1159
|
case 1:
|
|
@@ -1143,13 +1217,14 @@ var _counter = 0;
|
|
|
1143
1217
|
var _PREFIX = "__executor_end__";
|
|
1144
1218
|
var _PID36 = process.pid.toString(36);
|
|
1145
1219
|
function generateToken() {
|
|
1146
|
-
|
|
1220
|
+
_counter = _counter + 1 >>> 0;
|
|
1221
|
+
return "".concat(_PREFIX).concat(_counter.toString(36), "_").concat(_PID36);
|
|
1147
1222
|
}
|
|
1148
1223
|
function escape_type_of(obj) {
|
|
1149
1224
|
return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1150
1225
|
}
|
|
1151
1226
|
function escapeValue(value) {
|
|
1152
|
-
if ("string" == typeof value) return "'".concat(value.replace(/'/g, "''"), "'");
|
|
1227
|
+
if ("string" == typeof value) return value.includes("'") ? "'".concat(value.replace(/'/g, "''"), "'") : "'".concat(value, "'");
|
|
1153
1228
|
if (null == value) return "NULL";
|
|
1154
1229
|
if ("number" == typeof value || (void 0 === value ? "undefined" : escape_type_of(value)) === "bigint") return String(value);
|
|
1155
1230
|
if ("boolean" == typeof value) return value ? "TRUE" : "FALSE";
|
|
@@ -1323,7 +1398,7 @@ function queue_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
1323
1398
|
descriptor.value = value;
|
|
1324
1399
|
}
|
|
1325
1400
|
}
|
|
1326
|
-
function
|
|
1401
|
+
function queue_class_apply_descriptor_update(receiver, descriptor) {
|
|
1327
1402
|
if (descriptor.set) {
|
|
1328
1403
|
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1329
1404
|
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
@@ -1359,9 +1434,9 @@ function queue_class_private_field_set(receiver, privateMap, value) {
|
|
|
1359
1434
|
queue_class_apply_descriptor_set(receiver, descriptor, value);
|
|
1360
1435
|
return value;
|
|
1361
1436
|
}
|
|
1362
|
-
function
|
|
1437
|
+
function queue_class_private_field_update(receiver, privateMap) {
|
|
1363
1438
|
var descriptor = queue_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1364
|
-
return
|
|
1439
|
+
return queue_class_apply_descriptor_update(receiver, descriptor);
|
|
1365
1440
|
}
|
|
1366
1441
|
function _class_private_method_get(receiver, privateSet, fn) {
|
|
1367
1442
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
@@ -1516,7 +1591,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1516
1591
|
if (queue_class_private_field_get(this, _size) === queue_class_private_field_get(this, _items).length) _class_private_method_get(this, _grow, grow).call(this);
|
|
1517
1592
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = value;
|
|
1518
1593
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) + 1 & queue_class_private_field_get(this, _mask));
|
|
1519
|
-
|
|
1594
|
+
queue_class_private_field_update(this, _size).value++;
|
|
1520
1595
|
}
|
|
1521
1596
|
},
|
|
1522
1597
|
{
|
|
@@ -1526,7 +1601,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1526
1601
|
var value = queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _head)];
|
|
1527
1602
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _head)] = void 0;
|
|
1528
1603
|
queue_class_private_field_set(this, _head, queue_class_private_field_get(this, _head) + 1 & queue_class_private_field_get(this, _mask));
|
|
1529
|
-
|
|
1604
|
+
queue_class_private_field_update(this, _size).value--;
|
|
1530
1605
|
return value;
|
|
1531
1606
|
}
|
|
1532
1607
|
},
|
|
@@ -1553,7 +1628,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1553
1628
|
}
|
|
1554
1629
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) - 1 & queue_class_private_field_get(this, _mask));
|
|
1555
1630
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = void 0;
|
|
1556
|
-
|
|
1631
|
+
queue_class_private_field_update(this, _size).value--;
|
|
1557
1632
|
return true;
|
|
1558
1633
|
}
|
|
1559
1634
|
}
|
|
@@ -1772,6 +1847,9 @@ function buildBatchPayload(batch) {
|
|
|
1772
1847
|
}
|
|
1773
1848
|
return parts1.join("");
|
|
1774
1849
|
}
|
|
1850
|
+
function isSentinelRaw(raw, token) {
|
|
1851
|
+
return raw === '[{"'.concat(TOKEN_COLUMN, '":"').concat(token, '"}]');
|
|
1852
|
+
}
|
|
1775
1853
|
function isSentinelRow(value, token) {
|
|
1776
1854
|
var _value_;
|
|
1777
1855
|
return Array.isArray(value) && 1 === value.length && (null == (_value_ = value[0]) ? void 0 : _value_[TOKEN_COLUMN]) === token;
|
|
@@ -1834,6 +1912,8 @@ function processStreamRows(task, parsed) {
|
|
|
1834
1912
|
}
|
|
1835
1913
|
function settleTask(task, error, value, metrics) {
|
|
1836
1914
|
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
1915
|
+
if (task.settled) return;
|
|
1916
|
+
task.settled = true;
|
|
1837
1917
|
clearTimeout(task.timer);
|
|
1838
1918
|
if (resetRowParser) {
|
|
1839
1919
|
var _task_rowParser_reset, _task_rowParser;
|
|
@@ -1848,6 +1928,46 @@ function settleTask(task, error, value, metrics) {
|
|
|
1848
1928
|
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
1849
1929
|
task.resolve(value);
|
|
1850
1930
|
}
|
|
1931
|
+
function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
1932
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1933
|
+
try {
|
|
1934
|
+
for(var _iterator = tasks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1935
|
+
var task = _step.value;
|
|
1936
|
+
if (task.stderrText) {
|
|
1937
|
+
settle(task, new Error(task.stderrText.trim()), void 0);
|
|
1938
|
+
continue;
|
|
1939
|
+
}
|
|
1940
|
+
if (task.consumerError) {
|
|
1941
|
+
settle(task, task.consumerError, void 0);
|
|
1942
|
+
continue;
|
|
1943
|
+
}
|
|
1944
|
+
if ("query" === task.kind) {
|
|
1945
|
+
settle(task, null, task.rows);
|
|
1946
|
+
continue;
|
|
1947
|
+
}
|
|
1948
|
+
settle(task, null, void 0);
|
|
1949
|
+
}
|
|
1950
|
+
} catch (err) {
|
|
1951
|
+
_didIteratorError = true;
|
|
1952
|
+
_iteratorError = err;
|
|
1953
|
+
} finally{
|
|
1954
|
+
try {
|
|
1955
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1956
|
+
} finally{
|
|
1957
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
tasks.clear();
|
|
1961
|
+
pumpQueue();
|
|
1962
|
+
}
|
|
1963
|
+
function prepareTaskTimeout(task, metrics) {
|
|
1964
|
+
if (task.settled) return null;
|
|
1965
|
+
task.timedout = true;
|
|
1966
|
+
clearTimeout(task.timer);
|
|
1967
|
+
task.timer = null;
|
|
1968
|
+
null == metrics || metrics.incrementTasksTimeout();
|
|
1969
|
+
return createTimeoutError(task.timeout, task.sql);
|
|
1970
|
+
}
|
|
1851
1971
|
function taskWorker_array_like_to_array(arr, len) {
|
|
1852
1972
|
if (null == len || len > arr.length) len = arr.length;
|
|
1853
1973
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -2001,7 +2121,10 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2001
2121
|
taskWorker_class_private_field_set(this, _processManager, new process_ProcessManager({
|
|
2002
2122
|
binary: binary,
|
|
2003
2123
|
database: database,
|
|
2004
|
-
initMode: initMode
|
|
2124
|
+
initMode: initMode,
|
|
2125
|
+
onDrain: function() {
|
|
2126
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2127
|
+
}
|
|
2005
2128
|
}));
|
|
2006
2129
|
taskWorker_class_private_field_set(this, _valueParser, createJsonValueParser(function(raw) {
|
|
2007
2130
|
return taskWorker_class_private_method_get(_this, _handleParsedValue, handleParsedValue).call(_this, raw);
|
|
@@ -2043,13 +2166,20 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
2043
2166
|
onRow: null != (_config_onRow = config.onRow) ? _config_onRow : null,
|
|
2044
2167
|
consumerError: null,
|
|
2045
2168
|
stderrText: "",
|
|
2169
|
+
settled: false,
|
|
2046
2170
|
errorScheduled: false,
|
|
2047
2171
|
timer: null,
|
|
2048
2172
|
startTime: 0
|
|
2049
2173
|
};
|
|
2050
2174
|
null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _metrics)) || _$_class_private_field_get.incrementTasksTotal(config.kind);
|
|
2051
2175
|
taskWorker_class_private_field_get(this, _pendingQueue).enqueue(task);
|
|
2052
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2176
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2177
|
+
}
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
key: "_process",
|
|
2181
|
+
get: function() {
|
|
2182
|
+
return taskWorker_class_private_field_get(this, _processManager).process;
|
|
2053
2183
|
}
|
|
2054
2184
|
},
|
|
2055
2185
|
{
|
|
@@ -2083,9 +2213,10 @@ function startProcess() {
|
|
|
2083
2213
|
taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, err);
|
|
2084
2214
|
});
|
|
2085
2215
|
}
|
|
2086
|
-
function
|
|
2216
|
+
function taskWorker_pumpQueue() {
|
|
2087
2217
|
var _this = this;
|
|
2088
2218
|
var _$_class_private_field_get;
|
|
2219
|
+
if (taskWorker_class_private_field_get(this, _processManager).draining) return;
|
|
2089
2220
|
if (taskWorker_class_private_field_get(this, _inflightTasks).length >= taskWorker_class_private_field_get(this, _maxInflight)) return;
|
|
2090
2221
|
var batch = [];
|
|
2091
2222
|
while(batch.length < taskWorker_class_private_field_get(this, _batchSize) && !taskWorker_class_private_field_get(this, _pendingQueue).isEmpty() && taskWorker_class_private_field_get(this, _inflightTasks).length + batch.length < taskWorker_class_private_field_get(this, _maxInflight)){
|
|
@@ -2124,6 +2255,26 @@ function pumpQueue() {
|
|
|
2124
2255
|
function handleParsedValue(raw) {
|
|
2125
2256
|
var task = taskWorker_class_private_field_get(this, _inflightTasks)[0];
|
|
2126
2257
|
if (!task) return;
|
|
2258
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
2259
|
+
clearTimeout(task.timer);
|
|
2260
|
+
taskWorker_class_private_field_get(this, _inflightTasks).shift();
|
|
2261
|
+
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2262
|
+
if (task.stderrText) {
|
|
2263
|
+
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2264
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
if (task.consumerError) {
|
|
2268
|
+
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2269
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2273
|
+
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2274
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
if ("[]" === raw) return;
|
|
2127
2278
|
var parsed;
|
|
2128
2279
|
try {
|
|
2129
2280
|
parsed = JSON.parse(raw);
|
|
@@ -2134,19 +2285,20 @@ function handleParsedValue(raw) {
|
|
|
2134
2285
|
if (isSentinelRow(parsed, task.token)) {
|
|
2135
2286
|
clearTimeout(task.timer);
|
|
2136
2287
|
taskWorker_class_private_field_get(this, _inflightTasks).shift();
|
|
2288
|
+
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2137
2289
|
if (task.stderrText) {
|
|
2138
2290
|
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2139
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2291
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2140
2292
|
return;
|
|
2141
2293
|
}
|
|
2142
2294
|
if (task.consumerError) {
|
|
2143
2295
|
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2144
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2296
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2145
2297
|
return;
|
|
2146
2298
|
}
|
|
2147
2299
|
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2148
2300
|
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2149
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2301
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2150
2302
|
return;
|
|
2151
2303
|
}
|
|
2152
2304
|
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
@@ -2158,36 +2310,11 @@ function scheduleFinalizeCheck() {
|
|
|
2158
2310
|
taskWorker_class_private_field_set(this, _scheduledFinalize, true);
|
|
2159
2311
|
setImmediate(function() {
|
|
2160
2312
|
taskWorker_class_private_field_set(_this, _scheduledFinalize, false);
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, new Error(task.stderrText.trim()), void 0);
|
|
2167
|
-
continue;
|
|
2168
|
-
}
|
|
2169
|
-
if (task.consumerError) {
|
|
2170
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, task.consumerError, void 0);
|
|
2171
|
-
continue;
|
|
2172
|
-
}
|
|
2173
|
-
if ("query" === task.kind) {
|
|
2174
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, null, task.rows);
|
|
2175
|
-
continue;
|
|
2176
|
-
}
|
|
2177
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, null, void 0);
|
|
2178
|
-
}
|
|
2179
|
-
} catch (err) {
|
|
2180
|
-
_didIteratorError = true;
|
|
2181
|
-
_iteratorError = err;
|
|
2182
|
-
} finally{
|
|
2183
|
-
try {
|
|
2184
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2185
|
-
} finally{
|
|
2186
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
taskWorker_class_private_field_get(_this, _pendingFinalizeTasks).clear();
|
|
2190
|
-
taskWorker_class_private_method_get(_this, _pumpQueue, pumpQueue).call(_this);
|
|
2313
|
+
finalizePendingTasks(taskWorker_class_private_field_get(_this, _pendingFinalizeTasks), function(t, e, v1) {
|
|
2314
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2315
|
+
}, function() {
|
|
2316
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2317
|
+
});
|
|
2191
2318
|
});
|
|
2192
2319
|
}
|
|
2193
2320
|
function taskWorker_handleStderrChunk(chunk) {
|
|
@@ -2201,10 +2328,8 @@ function taskWorker_handleStderrChunk(chunk) {
|
|
|
2201
2328
|
task.stderrText += String(chunk);
|
|
2202
2329
|
}
|
|
2203
2330
|
function handleTaskTimeout(task) {
|
|
2204
|
-
var
|
|
2205
|
-
if (
|
|
2206
|
-
null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _metrics)) || _$_class_private_field_get.incrementTasksTimeout();
|
|
2207
|
-
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, createTimeoutError(task.timeout, task.sql));
|
|
2331
|
+
var error = prepareTaskTimeout(task, taskWorker_class_private_field_get(this, _metrics));
|
|
2332
|
+
if (error) taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, error, void 0);
|
|
2208
2333
|
}
|
|
2209
2334
|
function settleTask1(task, error, value) {
|
|
2210
2335
|
settleTask(task, error, value, taskWorker_class_private_field_get(this, _metrics));
|
|
@@ -2258,21 +2383,12 @@ function readerPool_class_apply_descriptor_get(receiver, descriptor) {
|
|
|
2258
2383
|
if (descriptor.get) return descriptor.get.call(receiver);
|
|
2259
2384
|
return descriptor.value;
|
|
2260
2385
|
}
|
|
2261
|
-
function
|
|
2262
|
-
if (descriptor.set)
|
|
2263
|
-
|
|
2264
|
-
if (!("
|
|
2265
|
-
|
|
2266
|
-
descriptor.set.call(receiver, v);
|
|
2267
|
-
},
|
|
2268
|
-
get value () {
|
|
2269
|
-
return descriptor.get.call(receiver);
|
|
2270
|
-
}
|
|
2271
|
-
};
|
|
2272
|
-
return descriptor.__destrWrapper;
|
|
2386
|
+
function readerPool_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
2387
|
+
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
2388
|
+
else {
|
|
2389
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
2390
|
+
descriptor.value = value;
|
|
2273
2391
|
}
|
|
2274
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
2275
|
-
return descriptor;
|
|
2276
2392
|
}
|
|
2277
2393
|
function readerPool_class_call_check(instance, Constructor) {
|
|
2278
2394
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -2289,9 +2405,10 @@ function readerPool_class_private_field_init(obj, privateMap, value) {
|
|
|
2289
2405
|
readerPool_check_private_redeclaration(obj, privateMap);
|
|
2290
2406
|
privateMap.set(obj, value);
|
|
2291
2407
|
}
|
|
2292
|
-
function
|
|
2293
|
-
var descriptor = readerPool_class_extract_field_descriptor(receiver, privateMap, "
|
|
2294
|
-
|
|
2408
|
+
function readerPool_class_private_field_set(receiver, privateMap, value) {
|
|
2409
|
+
var descriptor = readerPool_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
2410
|
+
readerPool_class_apply_descriptor_set(receiver, descriptor, value);
|
|
2411
|
+
return value;
|
|
2295
2412
|
}
|
|
2296
2413
|
function readerPool_defineProperties(target, props) {
|
|
2297
2414
|
for(var i = 0; i < props.length; i++){
|
|
@@ -2321,6 +2438,7 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2321
2438
|
writable: true,
|
|
2322
2439
|
value: 0
|
|
2323
2440
|
});
|
|
2441
|
+
if (poolSize < 1) throw new RangeError("poolSize must be >= 1");
|
|
2324
2442
|
for(var i = 0; i < poolSize; i++){
|
|
2325
2443
|
var worker = new taskWorker_TaskWorker({
|
|
2326
2444
|
binary: binary,
|
|
@@ -2353,10 +2471,16 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2353
2471
|
key: "enqueue",
|
|
2354
2472
|
value: function(task) {
|
|
2355
2473
|
var worker = readerPool_class_private_field_get(this, _workers)[readerPool_class_private_field_get(this, _rrIndex) % readerPool_class_private_field_get(this, _workers).length];
|
|
2356
|
-
|
|
2474
|
+
readerPool_class_private_field_set(this, _rrIndex, readerPool_class_private_field_get(this, _rrIndex) + 1 >>> 0);
|
|
2357
2475
|
worker.enqueue(task);
|
|
2358
2476
|
}
|
|
2359
2477
|
},
|
|
2478
|
+
{
|
|
2479
|
+
key: "_workers",
|
|
2480
|
+
get: function() {
|
|
2481
|
+
return readerPool_class_private_field_get(this, _workers);
|
|
2482
|
+
}
|
|
2483
|
+
},
|
|
2360
2484
|
{
|
|
2361
2485
|
key: "kill",
|
|
2362
2486
|
value: function() {
|
|
@@ -2969,7 +3093,7 @@ function pipelineEngine_unsupported_iterable_to_array(o, minLen) {
|
|
|
2969
3093
|
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
2970
3094
|
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineEngine_array_like_to_array(o, minLen);
|
|
2971
3095
|
}
|
|
2972
|
-
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightTasks = /*#__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(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), pipelineEngine_handleParsedValue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
3096
|
+
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightTasks = /*#__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(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), pipelineEngine_handleParsedValue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_handleTaskTimeout = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
2973
3097
|
var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
2974
3098
|
"use strict";
|
|
2975
3099
|
function PipelineEngine(processManager, param) {
|
|
@@ -2979,6 +3103,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
2979
3103
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_pumpQueue);
|
|
2980
3104
|
pipelineEngine_class_private_method_init(this, pipelineEngine_handleParsedValue);
|
|
2981
3105
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_scheduleFinalizeCheck);
|
|
3106
|
+
pipelineEngine_class_private_method_init(this, core_pipelineEngine_handleTaskTimeout);
|
|
2982
3107
|
pipelineEngine_class_private_method_init(this, pipelineEngine_settleTask);
|
|
2983
3108
|
pipelineEngine_class_private_field_init(this, _queue, {
|
|
2984
3109
|
writable: true,
|
|
@@ -3042,6 +3167,9 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
3042
3167
|
pipelineEngine_class_private_field_set(this, _sharedValueParser, createJsonValueParser(function(raw) {
|
|
3043
3168
|
return pipelineEngine_class_private_method_get(_this, pipelineEngine_handleParsedValue, core_pipelineEngine_handleParsedValue).call(_this, raw);
|
|
3044
3169
|
}));
|
|
3170
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).setOnDrainCallback(function() {
|
|
3171
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3172
|
+
});
|
|
3045
3173
|
}
|
|
3046
3174
|
pipelineEngine_create_class(PipelineEngine, [
|
|
3047
3175
|
{
|
|
@@ -3174,6 +3302,7 @@ function pipelineEngine_pumpQueue() {
|
|
|
3174
3302
|
var _this = this;
|
|
3175
3303
|
var _$_class_private_field_get;
|
|
3176
3304
|
if (!pipelineEngine_class_private_field_get(this, _active)) return;
|
|
3305
|
+
if (pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).draining) return;
|
|
3177
3306
|
if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length >= pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)) return;
|
|
3178
3307
|
var batch = [];
|
|
3179
3308
|
while(batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_batchSize) && !pipelineEngine_class_private_field_get(this, _queue).isEmpty() && pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length + batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)){
|
|
@@ -3191,8 +3320,7 @@ function pipelineEngine_pumpQueue() {
|
|
|
3191
3320
|
var task = _step.value;
|
|
3192
3321
|
task.startTime = now;
|
|
3193
3322
|
task.timer = setTimeout(function() {
|
|
3194
|
-
|
|
3195
|
-
pipelineEngine_class_private_field_get(_this, _onTaskTimeout).call(_this, task);
|
|
3323
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_handleTaskTimeout, pipelineEngine_handleTaskTimeout).call(_this, task);
|
|
3196
3324
|
}, task.timeout);
|
|
3197
3325
|
};
|
|
3198
3326
|
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
@@ -3212,6 +3340,21 @@ function pipelineEngine_pumpQueue() {
|
|
|
3212
3340
|
function core_pipelineEngine_handleParsedValue(raw) {
|
|
3213
3341
|
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[0];
|
|
3214
3342
|
if (!task) return;
|
|
3343
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
3344
|
+
clearTimeout(task.timer);
|
|
3345
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).shift();
|
|
3346
|
+
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3347
|
+
if (task.consumerError) {
|
|
3348
|
+
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3349
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3353
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3354
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
if ("[]" === raw) return;
|
|
3215
3358
|
var parsed;
|
|
3216
3359
|
try {
|
|
3217
3360
|
parsed = JSON.parse(raw);
|
|
@@ -3222,6 +3365,7 @@ function core_pipelineEngine_handleParsedValue(raw) {
|
|
|
3222
3365
|
if (isSentinelRow(parsed, task.token)) {
|
|
3223
3366
|
clearTimeout(task.timer);
|
|
3224
3367
|
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).shift();
|
|
3368
|
+
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3225
3369
|
if (task.consumerError) {
|
|
3226
3370
|
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3227
3371
|
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
@@ -3232,6 +3376,7 @@ function core_pipelineEngine_handleParsedValue(raw) {
|
|
|
3232
3376
|
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3233
3377
|
return;
|
|
3234
3378
|
}
|
|
3379
|
+
if (task.timedout) return;
|
|
3235
3380
|
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
3236
3381
|
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
3237
3382
|
}
|
|
@@ -3241,37 +3386,21 @@ function pipelineEngine_scheduleFinalizeCheck() {
|
|
|
3241
3386
|
pipelineEngine_class_private_field_set(this, pipelineEngine_scheduledFinalize, true);
|
|
3242
3387
|
setImmediate(function() {
|
|
3243
3388
|
pipelineEngine_class_private_field_set(_this, pipelineEngine_scheduledFinalize, false);
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, new Error(task.stderrText.trim()), void 0);
|
|
3250
|
-
continue;
|
|
3251
|
-
}
|
|
3252
|
-
if (task.consumerError) {
|
|
3253
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, task.consumerError, void 0);
|
|
3254
|
-
continue;
|
|
3255
|
-
}
|
|
3256
|
-
if ("query" === task.kind) {
|
|
3257
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, null, task.rows);
|
|
3258
|
-
continue;
|
|
3259
|
-
}
|
|
3260
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, null, void 0);
|
|
3261
|
-
}
|
|
3262
|
-
} catch (err) {
|
|
3263
|
-
_didIteratorError = true;
|
|
3264
|
-
_iteratorError = err;
|
|
3265
|
-
} finally{
|
|
3266
|
-
try {
|
|
3267
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3268
|
-
} finally{
|
|
3269
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks).clear();
|
|
3389
|
+
finalizePendingTasks(pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks), function(t, e, v1) {
|
|
3390
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3391
|
+
}, function() {
|
|
3392
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3393
|
+
});
|
|
3273
3394
|
});
|
|
3274
3395
|
}
|
|
3396
|
+
function pipelineEngine_handleTaskTimeout(task) {
|
|
3397
|
+
var _this, _this1;
|
|
3398
|
+
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics));
|
|
3399
|
+
if (error) {
|
|
3400
|
+
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, error, void 0);
|
|
3401
|
+
null == (_this = pipelineEngine_class_private_field_get(_this1 = this, _onTaskTimeout)) || _this.call(_this1, task);
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3275
3404
|
function pipelineEngine_settleTask1(task, error, value) {
|
|
3276
3405
|
settleTask(task, error, value, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics), {
|
|
3277
3406
|
resetRowParser: true
|
|
@@ -3499,7 +3628,6 @@ var _computedKey2 = executor_computedKey;
|
|
|
3499
3628
|
var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
3500
3629
|
"use strict";
|
|
3501
3630
|
function SQLiteExecutor() {
|
|
3502
|
-
var _this = this;
|
|
3503
3631
|
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, _ref_binary = _ref.binary, binary = void 0 === _ref_binary ? "sqlite3" : _ref_binary, _ref_database = _ref.database, database = void 0 === _ref_database ? ":memory:" : _ref_database, logger = _ref.logger, _ref_statementTimeout = _ref.statementTimeout, statementTimeout = void 0 === _ref_statementTimeout ? DEFAULT_STATEMENT_TIMEOUT : _ref_statementTimeout, _ref_autoRestart = _ref.autoRestart, autoRestart = void 0 === _ref_autoRestart ? true : _ref_autoRestart, _ref_poolSize = _ref.poolSize, poolSize = void 0 === _ref_poolSize ? 0 : _ref_poolSize, metrics = _ref.metrics;
|
|
3504
3632
|
executor_class_call_check(this, SQLiteExecutor);
|
|
3505
3633
|
executor_class_private_method_init(this, _normalizeTimeout);
|
|
@@ -3579,10 +3707,7 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
3579
3707
|
metrics: executor_class_private_field_get(this, executor_metrics),
|
|
3580
3708
|
statementTimeout: executor_class_private_field_get(this, executor_statementTimeout),
|
|
3581
3709
|
logger: executor_class_private_field_get(this, executor_logger),
|
|
3582
|
-
onTaskTimeout: function(
|
|
3583
|
-
executor_class_private_field_get(_this, executor_metrics).incrementTasksTimeout();
|
|
3584
|
-
executor_class_private_method_get(_this, _handleProcessFailure, handleProcessFailure).call(_this, createTimeoutError(task.timeout, task.sql));
|
|
3585
|
-
}
|
|
3710
|
+
onTaskTimeout: function() {}
|
|
3586
3711
|
}));
|
|
3587
3712
|
executor_class_private_method_get(this, executor_startProcess, core_executor_startProcess).call(this);
|
|
3588
3713
|
if (poolSize > 0 && ":memory:" !== database) executor_class_private_field_set(this, _readerPool, new readerPool_ReaderPool({
|
|
@@ -3609,6 +3734,12 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
3609
3734
|
return executor_class_private_field_get(this, _readerPool);
|
|
3610
3735
|
}
|
|
3611
3736
|
},
|
|
3737
|
+
{
|
|
3738
|
+
key: "_process",
|
|
3739
|
+
get: function() {
|
|
3740
|
+
return executor_class_private_field_get(this, executor_proc);
|
|
3741
|
+
}
|
|
3742
|
+
},
|
|
3612
3743
|
{
|
|
3613
3744
|
key: "metrics",
|
|
3614
3745
|
get: function() {
|
|
@@ -3898,6 +4029,7 @@ function enqueueWriter(kind, sql, timeout, token, onRow, scopeId) {
|
|
|
3898
4029
|
reject: reject,
|
|
3899
4030
|
consumerError: null,
|
|
3900
4031
|
stderrText: "",
|
|
4032
|
+
settled: false,
|
|
3901
4033
|
timer: null,
|
|
3902
4034
|
startTime: 0,
|
|
3903
4035
|
rowParser: null
|