@glimt/record 0.0.62 → 0.0.64

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
@@ -10466,13 +10466,18 @@ class MutationBuffer {
10466
10466
  __publicField(this, "stormBatches", []);
10467
10467
  __publicField(this, "stormInfo", null);
10468
10468
  __publicField(this, "stormSettings", {
10469
- batchSize: 150,
10469
+ batchSize: 50,
10470
10470
  //was 300
10471
10471
  timeout: 30,
10472
10472
  //was 50
10473
10473
  mutationLimit: 800
10474
10474
  //was 1500
10475
10475
  });
10476
+ __publicField(this, "rollingMutTracker", {
10477
+ accumlativeMuts: 0,
10478
+ ts: -1,
10479
+ interval: 10
10480
+ });
10476
10481
  __publicField(this, "handleStormMutations", (muts) => {
10477
10482
  const time = Date.now();
10478
10483
  if (this.stormInfo == null) {
@@ -10538,8 +10543,30 @@ class MutationBuffer {
10538
10543
  }
10539
10544
  });
10540
10545
  __publicField(this, "processInternalMutations", (muts, overrideStorm = false) => {
10541
- if (!overrideStorm && (this.stormInfo != null || muts.length >= this.stormSettings.batchSize)) {
10542
- this.handleStormMutations(muts);
10546
+ console.log("muts", muts.length);
10547
+ if (!overrideStorm) {
10548
+ if (this.stormInfo != null || muts.length >= this.stormSettings.batchSize) {
10549
+ this.handleStormMutations(muts);
10550
+ }
10551
+ if (this.stormInfo == null) {
10552
+ const now = Date.now();
10553
+ if (this.rollingMutTracker.ts === -1) {
10554
+ this.rollingMutTracker.accumlativeMuts = muts.length;
10555
+ } else {
10556
+ if (now - this.rollingMutTracker.ts <= this.rollingMutTracker.interval) {
10557
+ this.rollingMutTracker.accumlativeMuts += muts.length;
10558
+ if (this.rollingMutTracker.accumlativeMuts >= this.stormSettings.batchSize) {
10559
+ debugLog(`Mutation storm through rolling detected.`);
10560
+ this.handleStormMutations(muts);
10561
+ this.rollingMutTracker.accumlativeMuts = 0;
10562
+ this.rollingMutTracker.ts = -1;
10563
+ }
10564
+ } else {
10565
+ this.rollingMutTracker.accumlativeMuts = 0;
10566
+ }
10567
+ }
10568
+ this.rollingMutTracker.ts = now;
10569
+ }
10543
10570
  return;
10544
10571
  }
10545
10572
  for (const mut of muts) {