@firestitch/common 12.5.0 → 12.5.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.
@@ -1499,11 +1499,9 @@
1499
1499
  })(exports.QueueState || (exports.QueueState = {}));
1500
1500
 
1501
1501
  var Queue = /** @class */ (function () {
1502
- function Queue(_limit, _targets) {
1503
- var _this = this;
1502
+ function Queue(_limit) {
1504
1503
  if (_limit === void 0) { _limit = Infinity; }
1505
1504
  this._limit = _limit;
1506
- this._targets = _targets;
1507
1505
  this._queueStats = {
1508
1506
  completed: 0,
1509
1507
  total: 0,
@@ -1524,11 +1522,11 @@
1524
1522
  this._inProgress = [];
1525
1523
  this._state = exports.QueueState.Idle;
1526
1524
  this._destroy$ = new rxjs.Subject();
1527
- if (_targets) {
1528
- _targets.forEach(function (target) {
1529
- _this.push(target);
1530
- });
1531
- }
1525
+ // if(_targets) {
1526
+ // _targets.forEach((target) => {
1527
+ // this.push(target);
1528
+ // });
1529
+ // }
1532
1530
  }
1533
1531
  Object.defineProperty(Queue.prototype, "total", {
1534
1532
  get: function () {
@@ -1667,39 +1665,35 @@
1667
1665
  this._inProgress.push(operation);
1668
1666
  operation.target
1669
1667
  .pipe(operators.delay(200), // Hack to prevent extra quick proccess execution
1670
- operators.takeUntil(this._destroy$)).subscribe({
1668
+ operators.finalize(function () {
1669
+ var opIndex = _this._inProgress.indexOf(operation);
1670
+ _this._inProgress.splice(opIndex, 1);
1671
+ if (_this.empty) {
1672
+ _this._state = exports.QueueState.Idle;
1673
+ _this._done.next(_this._doneQueueStats);
1674
+ _this._clearDoneQueueStats();
1675
+ }
1676
+ else {
1677
+ if (_this._queue.length) {
1678
+ var queueItem = _this._queue.shift();
1679
+ _this._processOperation(queueItem);
1680
+ }
1681
+ }
1682
+ }), operators.takeUntil(this._destroy$)).subscribe({
1671
1683
  next: function (data) {
1672
1684
  operation.ready$.next(data);
1673
1685
  },
1674
1686
  error: function (error) {
1675
- var opIndex = _this._inProgress.indexOf(operation);
1676
- _this._inProgress.splice(opIndex, 1);
1677
1687
  _this._queueStats.errors.push(error);
1678
1688
  _this._doneQueueStats.errors.push(error);
1679
1689
  _this._completeQueueStats.errors.push(error);
1680
1690
  operation.ready$.error(error);
1681
- if (_this.empty) {
1682
- _this._state = exports.QueueState.Idle;
1683
- }
1684
1691
  },
1685
1692
  complete: function () {
1686
- var opIndex = _this._inProgress.indexOf(operation);
1687
- _this._inProgress.splice(opIndex, 1);
1688
1693
  _this._queueStats.completed++;
1689
1694
  _this._doneQueueStats.completed++;
1690
1695
  _this._completeQueueStats.completed++;
1691
1696
  operation.ready$.complete();
1692
- if (_this.empty) {
1693
- _this._state = exports.QueueState.Idle;
1694
- _this._done.next(_this._doneQueueStats);
1695
- _this._clearDoneQueueStats();
1696
- }
1697
- else {
1698
- if (_this._queue.length) {
1699
- var queueItem = _this._queue.shift();
1700
- _this._processOperation(queueItem);
1701
- }
1702
- }
1703
1697
  }
1704
1698
  });
1705
1699
  };