@glimt/record 0.0.28 → 0.0.30

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.
@@ -9429,6 +9429,15 @@ class DoubleLinkedList {
9429
9429
  }
9430
9430
  }
9431
9431
  const moveKey = (id, parentId) => `${id}@${parentId}`;
9432
+ function makeid(length = 8) {
9433
+ var result2 = "";
9434
+ var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
9435
+ var charactersLength = characters.length;
9436
+ for (var i2 = 0; i2 < length; i2++) {
9437
+ result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
9438
+ }
9439
+ return result2;
9440
+ }
9432
9441
  class MutationBuffer {
9433
9442
  constructor() {
9434
9443
  __publicField(this, "frozen", false);
@@ -9465,6 +9474,7 @@ class MutationBuffer {
9465
9474
  __publicField(this, "canvasManager");
9466
9475
  __publicField(this, "processedNodeManager");
9467
9476
  __publicField(this, "unattachedDoc");
9477
+ __publicField(this, "myId", makeid());
9468
9478
  __publicField(this, "stormBatches", []);
9469
9479
  __publicField(this, "stormInfo");
9470
9480
  __publicField(this, "stormSettings", {
@@ -9475,7 +9485,11 @@ class MutationBuffer {
9475
9485
  __publicField(this, "handleStormMutations", (muts) => {
9476
9486
  const time = Date.now();
9477
9487
  if (this.stormInfo == null) {
9478
- console.log("detected probable mutation storm start");
9488
+ console.log(
9489
+ "detected probable mutation storm start",
9490
+ "buffer id:",
9491
+ this.myId
9492
+ );
9479
9493
  this.stormInfo = {
9480
9494
  startedAt: time,
9481
9495
  totalMutations: 0,
@@ -9484,7 +9498,12 @@ class MutationBuffer {
9484
9498
  };
9485
9499
  }
9486
9500
  this.stormInfo.totalMutations += muts.length;
9487
- console.log("current storm mutations", this.stormInfo.totalMutations);
9501
+ console.log(
9502
+ "current storm mutations",
9503
+ this.stormInfo.totalMutations,
9504
+ "buffer id:",
9505
+ this.myId
9506
+ );
9488
9507
  if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
9489
9508
  this.stormInfo.stormExceededLimit = true;
9490
9509
  this.stormBatches = [];
@@ -9507,7 +9526,12 @@ class MutationBuffer {
9507
9526
  "totalMutations:",
9508
9527
  this.stormInfo.totalMutations,
9509
9528
  "stormExceededLimit:",
9510
- stormExceededLimit
9529
+ stormExceededLimit,
9530
+ "storm duration:",
9531
+ Date.now() - this.stormInfo.startedAt,
9532
+ "ms",
9533
+ "buffer id:",
9534
+ this.myId
9511
9535
  );
9512
9536
  clearTimeout(this.stormInfo.timeout);
9513
9537
  this.stormInfo = null;
@@ -9538,7 +9562,9 @@ class MutationBuffer {
9538
9562
  performance.now() - start,
9539
9563
  "ms",
9540
9564
  "overrideStorm",
9541
- overrideStorm
9565
+ overrideStorm,
9566
+ "buffer id:",
9567
+ this.myId
9542
9568
  );
9543
9569
  this.emit();
9544
9570
  });