neo4j-driver 5.24.0 → 5.24.1

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