@glimt/record 0.0.66 → 0.0.68

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
@@ -10327,12 +10327,16 @@ const _StormSnapshotManager = class _StormSnapshotManager2 {
10327
10327
  __publicField(_StormSnapshotManager, "instance");
10328
10328
  let StormSnapshotManager = _StormSnapshotManager;
10329
10329
  const stormSnapshotManager = new StormSnapshotManager();
10330
- class MutationRateLimiter {
10330
+ const _MutationRateLimiter = class _MutationRateLimiter2 {
10331
10331
  constructor() {
10332
10332
  __publicField(this, "mutTracker");
10333
10333
  __publicField(this, "interval", 50);
10334
- __publicField(this, "limit", 150);
10334
+ __publicField(this, "limit", 100);
10335
10335
  __publicField(this, "inGlobalStorm", false);
10336
+ if (_MutationRateLimiter2.instance) {
10337
+ return _MutationRateLimiter2.instance;
10338
+ }
10339
+ _MutationRateLimiter2.instance = this;
10336
10340
  debugLog(`MutationRateLimiter, init`);
10337
10341
  this.reset();
10338
10342
  }
@@ -10345,11 +10349,15 @@ class MutationRateLimiter {
10345
10349
  isStorming(muts) {
10346
10350
  const now = Date.now();
10347
10351
  if (this.inGlobalStorm) {
10352
+ this.mutTracker.muts += muts;
10348
10353
  if (now - this.mutTracker.ts > this.interval) {
10349
10354
  this.inGlobalStorm = false;
10350
- debugLog(`MutationRateLimiter, detected global storm over`);
10355
+ debugLog(
10356
+ `MutationRateLimiter, detected global storm over. Total mutations stormed: ${this.mutTracker.muts}`
10357
+ );
10351
10358
  return false;
10352
10359
  }
10360
+ this.mutTracker.ts = now;
10353
10361
  return true;
10354
10362
  }
10355
10363
  if (this.mutTracker.ts === -1) {
@@ -10368,7 +10376,9 @@ class MutationRateLimiter {
10368
10376
  this.mutTracker.ts = now;
10369
10377
  return false;
10370
10378
  }
10371
- }
10379
+ };
10380
+ __publicField(_MutationRateLimiter, "instance");
10381
+ let MutationRateLimiter = _MutationRateLimiter;
10372
10382
  const mutationRateLimiter = new MutationRateLimiter();
10373
10383
  function isNodeInLinkedList(n2) {
10374
10384
  return "__ln" in n2;
@@ -10506,11 +10516,6 @@ class MutationBuffer {
10506
10516
  mutationLimit: 800
10507
10517
  //was 1500
10508
10518
  });
10509
- __publicField(this, "rollingMutTracker", {
10510
- accumlativeMuts: 0,
10511
- ts: -1,
10512
- interval: 50
10513
- });
10514
10519
  __publicField(this, "handleStormMutations", (muts, canFinishStorm = true) => {
10515
10520
  const time = Date.now();
10516
10521
  if (this.stormInfo == null) {
@@ -10576,11 +10581,6 @@ class MutationBuffer {
10576
10581
  }
10577
10582
  });
10578
10583
  __publicField(this, "processInternalMutations", (muts, overrideStorm = false) => {
10579
- console.log(
10580
- "muts",
10581
- muts.length,
10582
- JSON.parse(JSON.stringify(this.rollingMutTracker))
10583
- );
10584
10584
  if (!overrideStorm) {
10585
10585
  const isStorming = mutationRateLimiter.isStorming(muts.length);
10586
10586
  if (isStorming) {