@glimt/record 0.0.70 → 0.0.71

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/record.js CHANGED
@@ -10397,6 +10397,9 @@ const _MutationRateLimiter = class _MutationRateLimiter2 {
10397
10397
  }
10398
10398
  return true;
10399
10399
  }
10400
+ canMutationBufferExitMutationStorm() {
10401
+ return !this.inGlobalStorm;
10402
+ }
10400
10403
  isStorming(muts) {
10401
10404
  const now = Date.now();
10402
10405
  if (this.inGlobalStorm) {
@@ -10565,11 +10568,18 @@ class MutationBuffer {
10565
10568
  __publicField(this, "stormSettings", {
10566
10569
  batchSize: 50,
10567
10570
  //was 300
10568
- timeout: 30,
10571
+ timeout: 50,
10569
10572
  //was 50
10570
10573
  mutationLimit: 800
10571
10574
  //was 1500
10572
10575
  });
10576
+ __publicField(this, "debounceStormFinish", () => {
10577
+ if (!this.stormInfo) return;
10578
+ this.stormInfo.timeout = setTimeout(
10579
+ this.handleStormFinish,
10580
+ this.stormSettings.timeout
10581
+ );
10582
+ });
10573
10583
  __publicField(this, "handleStormMutations", (muts, canFinishStorm = true) => {
10574
10584
  const time = Date.now();
10575
10585
  if (this.stormInfo == null) {
@@ -10599,14 +10609,15 @@ class MutationBuffer {
10599
10609
  if (canFinishStorm && muts.length < this.stormSettings.batchSize) {
10600
10610
  this.handleStormFinish();
10601
10611
  } else {
10602
- this.stormInfo.timeout = setTimeout(
10603
- this.handleStormFinish,
10604
- this.stormSettings.timeout
10605
- );
10612
+ this.debounceStormFinish();
10606
10613
  }
10607
10614
  });
10608
10615
  __publicField(this, "handleStormFinish", () => {
10609
10616
  if (!this.stormInfo) return;
10617
+ if (!mutationRateLimiter.canMutationBufferExitMutationStorm()) {
10618
+ this.debounceStormFinish();
10619
+ return;
10620
+ }
10610
10621
  const { stormExceededLimit } = this.stormInfo;
10611
10622
  debugLog(
10612
10623
  "mutation storm finished",