@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.
@@ -10441,6 +10441,9 @@ const _MutationRateLimiter = class _MutationRateLimiter2 {
10441
10441
  }
10442
10442
  return true;
10443
10443
  }
10444
+ canMutationBufferExitMutationStorm() {
10445
+ return !this.inGlobalStorm;
10446
+ }
10444
10447
  isStorming(muts) {
10445
10448
  const now = Date.now();
10446
10449
  if (this.inGlobalStorm) {
@@ -10609,11 +10612,18 @@ class MutationBuffer {
10609
10612
  __publicField(this, "stormSettings", {
10610
10613
  batchSize: 50,
10611
10614
  //was 300
10612
- timeout: 30,
10615
+ timeout: 50,
10613
10616
  //was 50
10614
10617
  mutationLimit: 800
10615
10618
  //was 1500
10616
10619
  });
10620
+ __publicField(this, "debounceStormFinish", () => {
10621
+ if (!this.stormInfo) return;
10622
+ this.stormInfo.timeout = setTimeout(
10623
+ this.handleStormFinish,
10624
+ this.stormSettings.timeout
10625
+ );
10626
+ });
10617
10627
  __publicField(this, "handleStormMutations", (muts, canFinishStorm = true) => {
10618
10628
  const time = Date.now();
10619
10629
  if (this.stormInfo == null) {
@@ -10643,14 +10653,15 @@ class MutationBuffer {
10643
10653
  if (canFinishStorm && muts.length < this.stormSettings.batchSize) {
10644
10654
  this.handleStormFinish();
10645
10655
  } else {
10646
- this.stormInfo.timeout = setTimeout(
10647
- this.handleStormFinish,
10648
- this.stormSettings.timeout
10649
- );
10656
+ this.debounceStormFinish();
10650
10657
  }
10651
10658
  });
10652
10659
  __publicField(this, "handleStormFinish", () => {
10653
10660
  if (!this.stormInfo) return;
10661
+ if (!mutationRateLimiter.canMutationBufferExitMutationStorm()) {
10662
+ this.debounceStormFinish();
10663
+ return;
10664
+ }
10654
10665
  const { stormExceededLimit } = this.stormInfo;
10655
10666
  debugLog(
10656
10667
  "mutation storm finished",