@glimt/record 0.0.63 → 0.0.65

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
@@ -1991,16 +1991,6 @@ function serializeNodeWithId(n2, options) {
1991
1991
  debugging.store[n2.nodeName].push(took);
1992
1992
  if (debugging.index % 5e3 === 0) {
1993
1993
  debugging.index = 0;
1994
- const avgs = Object.entries(debugging.store).map(([key, values]) => {
1995
- return {
1996
- tagName: key,
1997
- avg: values.reduce((a2, b) => a2 + b, 0) / values.length,
1998
- max: Math.max(...values),
1999
- min: Math.min(...values)
2000
- };
2001
- });
2002
- console.log("last 5000 avgs");
2003
- console.table(avgs);
2004
1994
  debugging.store = {};
2005
1995
  }
2006
1996
  return serializedNode;
@@ -10471,6 +10461,11 @@ class MutationBuffer {
10471
10461
  mutationLimit: 800
10472
10462
  //was 1500
10473
10463
  });
10464
+ __publicField(this, "rollingMutTracker", {
10465
+ accumlativeMuts: 0,
10466
+ ts: -1,
10467
+ interval: 50
10468
+ });
10474
10469
  __publicField(this, "handleStormMutations", (muts) => {
10475
10470
  const time = Date.now();
10476
10471
  if (this.stormInfo == null) {
@@ -10536,9 +10531,34 @@ class MutationBuffer {
10536
10531
  }
10537
10532
  });
10538
10533
  __publicField(this, "processInternalMutations", (muts, overrideStorm = false) => {
10539
- console.log("muts", muts.length);
10540
- if (!overrideStorm && (this.stormInfo != null || muts.length >= this.stormSettings.batchSize)) {
10541
- this.handleStormMutations(muts);
10534
+ console.log(
10535
+ "muts",
10536
+ muts.length,
10537
+ JSON.parse(JSON.stringify(this.rollingMutTracker))
10538
+ );
10539
+ if (!overrideStorm) {
10540
+ if (this.stormInfo != null || muts.length >= this.stormSettings.batchSize) {
10541
+ this.handleStormMutations(muts);
10542
+ }
10543
+ if (this.stormInfo == null) {
10544
+ const now = Date.now();
10545
+ if (this.rollingMutTracker.ts === -1) {
10546
+ this.rollingMutTracker.accumlativeMuts = muts.length;
10547
+ } else {
10548
+ if (now - this.rollingMutTracker.ts <= this.rollingMutTracker.interval) {
10549
+ this.rollingMutTracker.accumlativeMuts += muts.length;
10550
+ if (this.rollingMutTracker.accumlativeMuts >= this.stormSettings.batchSize) {
10551
+ debugLog(`Mutation storm through rolling detected.`);
10552
+ this.handleStormMutations(muts);
10553
+ this.rollingMutTracker.accumlativeMuts = 0;
10554
+ this.rollingMutTracker.ts = -1;
10555
+ }
10556
+ } else {
10557
+ this.rollingMutTracker.accumlativeMuts = 0;
10558
+ }
10559
+ }
10560
+ this.rollingMutTracker.ts = now;
10561
+ }
10542
10562
  return;
10543
10563
  }
10544
10564
  for (const mut of muts) {