neo4j-driver 5.24.0 → 5.25.0
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.
|
@@ -5764,7 +5764,7 @@ var Pool$1 = /** @class */ (function () {
|
|
|
5764
5764
|
};
|
|
5765
5765
|
Pool.prototype._acquire = function (acquisitionContext, address, requireNew) {
|
|
5766
5766
|
return __awaiter$i(this, void 0, void 0, function () {
|
|
5767
|
-
var key, pool, resource_1, numConnections, resource, numConnections, resource_2;
|
|
5767
|
+
var key, pool, resource_1, valid, e_1, numConnections, resource, numConnections, resource_2;
|
|
5768
5768
|
var _this = this;
|
|
5769
5769
|
return __generator$k(this, function (_a) {
|
|
5770
5770
|
switch (_a.label) {
|
|
@@ -5774,35 +5774,51 @@ var Pool$1 = /** @class */ (function () {
|
|
|
5774
5774
|
}
|
|
5775
5775
|
key = address.asKey();
|
|
5776
5776
|
pool = this._getOrInitializePoolFor(key);
|
|
5777
|
-
if (!!requireNew) return [3 /*break*/,
|
|
5777
|
+
if (!!requireNew) return [3 /*break*/, 10];
|
|
5778
5778
|
_a.label = 1;
|
|
5779
5779
|
case 1:
|
|
5780
|
-
if (!(pool.length > 0)) return [3 /*break*/,
|
|
5780
|
+
if (!(pool.length > 0)) return [3 /*break*/, 10];
|
|
5781
5781
|
resource_1 = pool.pop();
|
|
5782
5782
|
if (resource_1 == null) {
|
|
5783
5783
|
return [3 /*break*/, 1];
|
|
5784
5784
|
}
|
|
5785
|
+
resourceAcquired(key, this._activeResourceCounts);
|
|
5785
5786
|
if (this._removeIdleObserver != null) {
|
|
5786
5787
|
this._removeIdleObserver(resource_1);
|
|
5787
5788
|
}
|
|
5788
|
-
|
|
5789
|
+
valid = false;
|
|
5790
|
+
_a.label = 2;
|
|
5789
5791
|
case 2:
|
|
5790
|
-
|
|
5792
|
+
_a.trys.push([2, 4, , 6]);
|
|
5793
|
+
return [4 /*yield*/, this._validateOnAcquire(acquisitionContext, resource_1)];
|
|
5794
|
+
case 3:
|
|
5795
|
+
valid = _a.sent();
|
|
5796
|
+
return [3 /*break*/, 6];
|
|
5797
|
+
case 4:
|
|
5798
|
+
e_1 = _a.sent();
|
|
5799
|
+
resourceReleased(key, this._activeResourceCounts);
|
|
5800
|
+
pool.removeInUse(resource_1);
|
|
5801
|
+
return [4 /*yield*/, this._destroy(resource_1)];
|
|
5802
|
+
case 5:
|
|
5803
|
+
_a.sent();
|
|
5804
|
+
throw e_1;
|
|
5805
|
+
case 6:
|
|
5806
|
+
if (!valid) return [3 /*break*/, 7];
|
|
5791
5807
|
// idle resource is valid and can be acquired
|
|
5792
|
-
resourceAcquired(key, this._activeResourceCounts);
|
|
5793
5808
|
if (this._log.isDebugEnabled()) {
|
|
5794
5809
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
5795
5810
|
this._log.debug("".concat(resource_1, " acquired from the pool ").concat(key));
|
|
5796
5811
|
}
|
|
5797
5812
|
return [2 /*return*/, { resource: resource_1, pool: pool }];
|
|
5798
|
-
case
|
|
5813
|
+
case 7:
|
|
5814
|
+
resourceReleased(key, this._activeResourceCounts);
|
|
5799
5815
|
pool.removeInUse(resource_1);
|
|
5800
5816
|
return [4 /*yield*/, this._destroy(resource_1)];
|
|
5801
|
-
case
|
|
5817
|
+
case 8:
|
|
5802
5818
|
_a.sent();
|
|
5803
|
-
_a.label =
|
|
5804
|
-
case
|
|
5805
|
-
case
|
|
5819
|
+
_a.label = 9;
|
|
5820
|
+
case 9: return [3 /*break*/, 1];
|
|
5821
|
+
case 10:
|
|
5806
5822
|
// Ensure requested max pool size
|
|
5807
5823
|
if (this._maxSize > 0) {
|
|
5808
5824
|
numConnections = this.activeResourceCount(address) + this._pendingCreates[key];
|
|
@@ -5814,28 +5830,28 @@ var Pool$1 = /** @class */ (function () {
|
|
|
5814
5830
|
// there exist no idle valid resources, create a new one for acquisition
|
|
5815
5831
|
// Keep track of how many pending creates there are to avoid making too many connections.
|
|
5816
5832
|
this._pendingCreates[key] = this._pendingCreates[key] + 1;
|
|
5817
|
-
_a.label =
|
|
5818
|
-
case
|
|
5819
|
-
_a.trys.push([
|
|
5833
|
+
_a.label = 11;
|
|
5834
|
+
case 11:
|
|
5835
|
+
_a.trys.push([11, , 15, 16]);
|
|
5820
5836
|
numConnections = this.activeResourceCount(address) + pool.length;
|
|
5821
|
-
if (!(numConnections >= this._maxSize && requireNew)) return [3 /*break*/,
|
|
5837
|
+
if (!(numConnections >= this._maxSize && requireNew)) return [3 /*break*/, 13];
|
|
5822
5838
|
resource_2 = pool.pop();
|
|
5823
|
-
if (!(resource_2 != null)) return [3 /*break*/,
|
|
5839
|
+
if (!(resource_2 != null)) return [3 /*break*/, 13];
|
|
5824
5840
|
if (this._removeIdleObserver != null) {
|
|
5825
5841
|
this._removeIdleObserver(resource_2);
|
|
5826
5842
|
}
|
|
5827
5843
|
pool.removeInUse(resource_2);
|
|
5828
5844
|
return [4 /*yield*/, this._destroy(resource_2)];
|
|
5829
|
-
case
|
|
5845
|
+
case 12:
|
|
5830
5846
|
_a.sent();
|
|
5831
|
-
_a.label =
|
|
5832
|
-
case
|
|
5847
|
+
_a.label = 13;
|
|
5848
|
+
case 13: return [4 /*yield*/, this._create(acquisitionContext, address, function (address, resource) { return __awaiter$i(_this, void 0, void 0, function () { return __generator$k(this, function (_a) {
|
|
5833
5849
|
switch (_a.label) {
|
|
5834
5850
|
case 0: return [4 /*yield*/, this._release(address, resource, pool)];
|
|
5835
5851
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5836
5852
|
}
|
|
5837
5853
|
}); }); })];
|
|
5838
|
-
case
|
|
5854
|
+
case 14:
|
|
5839
5855
|
// Invoke callback that creates actual connection
|
|
5840
5856
|
resource = _a.sent();
|
|
5841
5857
|
pool.pushInUse(resource);
|
|
@@ -5844,11 +5860,11 @@ var Pool$1 = /** @class */ (function () {
|
|
|
5844
5860
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
5845
5861
|
this._log.debug("".concat(resource, " created for the pool ").concat(key));
|
|
5846
5862
|
}
|
|
5847
|
-
return [3 /*break*/,
|
|
5848
|
-
case
|
|
5863
|
+
return [3 /*break*/, 16];
|
|
5864
|
+
case 15:
|
|
5849
5865
|
this._pendingCreates[key] = this._pendingCreates[key] - 1;
|
|
5850
5866
|
return [7 /*endfinally*/];
|
|
5851
|
-
case
|
|
5867
|
+
case 16: return [2 /*return*/, { resource: resource, pool: pool }];
|
|
5852
5868
|
}
|
|
5853
5869
|
});
|
|
5854
5870
|
});
|
|
@@ -21667,7 +21683,7 @@ Object.defineProperty(version$1, "__esModule", { value: true });
|
|
|
21667
21683
|
// This is set up this way to keep the version in the code in
|
|
21668
21684
|
// sync with the npm package version, and to allow the build
|
|
21669
21685
|
// system to control version names at packaging time.
|
|
21670
|
-
version$1.default = '5.
|
|
21686
|
+
version$1.default = '5.25.0';
|
|
21671
21687
|
|
|
21672
21688
|
var lib = {};
|
|
21673
21689
|
|