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