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