@fluidframework/container-runtime 2.0.0-internal.1.0.0.82693 → 2.0.0-internal.1.1.0

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.
Files changed (128) hide show
  1. package/.mocharc.js +12 -0
  2. package/dist/batchTracker.js +1 -1
  3. package/dist/batchTracker.js.map +1 -1
  4. package/dist/blobManager.d.ts +7 -1
  5. package/dist/blobManager.d.ts.map +1 -1
  6. package/dist/blobManager.js +34 -17
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/containerRuntime.d.ts +3 -104
  9. package/dist/containerRuntime.d.ts.map +1 -1
  10. package/dist/containerRuntime.js +83 -395
  11. package/dist/containerRuntime.js.map +1 -1
  12. package/dist/dataStore.d.ts +1 -1
  13. package/dist/dataStore.d.ts.map +1 -1
  14. package/dist/dataStore.js +2 -3
  15. package/dist/dataStore.js.map +1 -1
  16. package/dist/dataStoreContext.d.ts +3 -5
  17. package/dist/dataStoreContext.d.ts.map +1 -1
  18. package/dist/dataStoreContext.js +13 -23
  19. package/dist/dataStoreContext.js.map +1 -1
  20. package/dist/dataStores.d.ts +1 -1
  21. package/dist/dataStores.d.ts.map +1 -1
  22. package/dist/dataStores.js +3 -8
  23. package/dist/dataStores.js.map +1 -1
  24. package/dist/garbageCollection.d.ts +37 -6
  25. package/dist/garbageCollection.d.ts.map +1 -1
  26. package/dist/garbageCollection.js +61 -65
  27. package/dist/garbageCollection.js.map +1 -1
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/packageVersion.d.ts +1 -1
  33. package/dist/packageVersion.d.ts.map +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/pendingStateManager.d.ts.map +1 -1
  37. package/dist/pendingStateManager.js +15 -2
  38. package/dist/pendingStateManager.js.map +1 -1
  39. package/dist/runningSummarizer.d.ts +14 -0
  40. package/dist/runningSummarizer.d.ts.map +1 -1
  41. package/dist/runningSummarizer.js +25 -0
  42. package/dist/runningSummarizer.js.map +1 -1
  43. package/dist/scheduleManager.d.ts +28 -0
  44. package/dist/scheduleManager.d.ts.map +1 -0
  45. package/dist/scheduleManager.js +235 -0
  46. package/dist/scheduleManager.js.map +1 -0
  47. package/dist/summarizer.d.ts.map +1 -1
  48. package/dist/summarizer.js +33 -3
  49. package/dist/summarizer.js.map +1 -1
  50. package/dist/summaryCollection.js +1 -1
  51. package/dist/summaryCollection.js.map +1 -1
  52. package/dist/summaryGenerator.js +1 -1
  53. package/dist/summaryGenerator.js.map +1 -1
  54. package/dist/summaryManager.d.ts.map +1 -1
  55. package/dist/summaryManager.js +20 -5
  56. package/dist/summaryManager.js.map +1 -1
  57. package/lib/batchTracker.js +1 -1
  58. package/lib/batchTracker.js.map +1 -1
  59. package/lib/blobManager.d.ts +7 -1
  60. package/lib/blobManager.d.ts.map +1 -1
  61. package/lib/blobManager.js +35 -18
  62. package/lib/blobManager.js.map +1 -1
  63. package/lib/containerRuntime.d.ts +3 -104
  64. package/lib/containerRuntime.d.ts.map +1 -1
  65. package/lib/containerRuntime.js +84 -395
  66. package/lib/containerRuntime.js.map +1 -1
  67. package/lib/dataStore.d.ts +1 -1
  68. package/lib/dataStore.d.ts.map +1 -1
  69. package/lib/dataStore.js +2 -3
  70. package/lib/dataStore.js.map +1 -1
  71. package/lib/dataStoreContext.d.ts +3 -5
  72. package/lib/dataStoreContext.d.ts.map +1 -1
  73. package/lib/dataStoreContext.js +13 -23
  74. package/lib/dataStoreContext.js.map +1 -1
  75. package/lib/dataStores.d.ts +1 -1
  76. package/lib/dataStores.d.ts.map +1 -1
  77. package/lib/dataStores.js +3 -8
  78. package/lib/dataStores.js.map +1 -1
  79. package/lib/garbageCollection.d.ts +37 -6
  80. package/lib/garbageCollection.d.ts.map +1 -1
  81. package/lib/garbageCollection.js +47 -52
  82. package/lib/garbageCollection.js.map +1 -1
  83. package/lib/index.d.ts +2 -1
  84. package/lib/index.d.ts.map +1 -1
  85. package/lib/index.js +2 -1
  86. package/lib/index.js.map +1 -1
  87. package/lib/packageVersion.d.ts +1 -1
  88. package/lib/packageVersion.d.ts.map +1 -1
  89. package/lib/packageVersion.js +1 -1
  90. package/lib/packageVersion.js.map +1 -1
  91. package/lib/pendingStateManager.d.ts.map +1 -1
  92. package/lib/pendingStateManager.js +15 -2
  93. package/lib/pendingStateManager.js.map +1 -1
  94. package/lib/runningSummarizer.d.ts +14 -0
  95. package/lib/runningSummarizer.d.ts.map +1 -1
  96. package/lib/runningSummarizer.js +25 -0
  97. package/lib/runningSummarizer.js.map +1 -1
  98. package/lib/scheduleManager.d.ts +28 -0
  99. package/lib/scheduleManager.d.ts.map +1 -0
  100. package/lib/scheduleManager.js +231 -0
  101. package/lib/scheduleManager.js.map +1 -0
  102. package/lib/summarizer.d.ts.map +1 -1
  103. package/lib/summarizer.js +35 -5
  104. package/lib/summarizer.js.map +1 -1
  105. package/lib/summaryCollection.js +1 -1
  106. package/lib/summaryCollection.js.map +1 -1
  107. package/lib/summaryGenerator.js +1 -1
  108. package/lib/summaryGenerator.js.map +1 -1
  109. package/lib/summaryManager.d.ts.map +1 -1
  110. package/lib/summaryManager.js +20 -5
  111. package/lib/summaryManager.js.map +1 -1
  112. package/package.json +32 -19
  113. package/src/batchTracker.ts +1 -1
  114. package/src/blobManager.ts +43 -17
  115. package/src/containerRuntime.ts +113 -547
  116. package/src/dataStore.ts +1 -4
  117. package/src/dataStoreContext.ts +10 -25
  118. package/src/dataStores.ts +13 -19
  119. package/src/garbageCollection.ts +64 -69
  120. package/src/index.ts +1 -2
  121. package/src/packageVersion.ts +1 -1
  122. package/src/pendingStateManager.ts +18 -2
  123. package/src/runningSummarizer.ts +33 -1
  124. package/src/scheduleManager.ts +294 -0
  125. package/src/summarizer.ts +46 -10
  126. package/src/summaryCollection.ts +1 -1
  127. package/src/summaryGenerator.ts +1 -1
  128. package/src/summaryManager.ts +20 -5
@@ -15,7 +15,7 @@ var __rest = (this && this.__rest) || function (s, e) {
15
15
  return t;
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.GarbageCollector = exports.GCNodeType = exports.defaultSessionExpiryDurationMs = exports.oneDayMs = exports.trackGCStateKey = exports.disableSessionExpiryKey = exports.runSessionExpiryKey = exports.gcBlobPrefix = exports.gcTreeKey = void 0;
18
+ exports.GarbageCollector = exports.UnreferencedStateTracker = exports.UnreferencedState = exports.GCNodeType = exports.defaultSessionExpiryDurationMs = exports.defaultInactiveTimeoutMs = exports.oneDayMs = exports.trackGCStateKey = exports.disableSessionExpiryKey = exports.runSessionExpiryKey = exports.gcTestModeKey = exports.runSweepKey = exports.runGCKey = exports.gcBlobPrefix = exports.gcTreeKey = void 0;
19
19
  const common_utils_1 = require("@fluidframework/common-utils");
20
20
  const container_utils_1 = require("@fluidframework/container-utils");
21
21
  const garbage_collector_1 = require("@fluidframework/garbage-collector");
@@ -33,11 +33,11 @@ exports.gcTreeKey = "gc";
33
33
  // They prefix for GC blobs in the GC tree in summary.
34
34
  exports.gcBlobPrefix = "__gc";
35
35
  // Feature gate key to turn GC on / off.
36
- const runGCKey = "Fluid.GarbageCollection.RunGC";
36
+ exports.runGCKey = "Fluid.GarbageCollection.RunGC";
37
37
  // Feature gate key to turn GC sweep on / off.
38
- // const runSweepKey = "Fluid.GarbageCollection.RunSweep";
38
+ exports.runSweepKey = "Fluid.GarbageCollection.RunSweep";
39
39
  // Feature gate key to turn GC test mode on / off.
40
- const gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
40
+ exports.gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
41
41
  // Feature gate key to write GC data at the root of the summary tree.
42
42
  const writeAtRootKey = "Fluid.GarbageCollection.WriteDataAtRoot";
43
43
  // Feature gate key to expire a session after a set period of time.
@@ -50,7 +50,7 @@ exports.trackGCStateKey = "Fluid.GarbageCollection.TrackGCState";
50
50
  const disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
51
51
  // One day in milliseconds.
52
52
  exports.oneDayMs = 1 * 24 * 60 * 60 * 1000;
53
- const defaultInactiveTimeoutMs = 7 * exports.oneDayMs; // 7 days
53
+ exports.defaultInactiveTimeoutMs = 7 * exports.oneDayMs; // 7 days
54
54
  exports.defaultSessionExpiryDurationMs = 30 * exports.oneDayMs; // 30 days
55
55
  /** The types of GC nodes in the GC reference graph. */
56
56
  exports.GCNodeType = {
@@ -64,7 +64,7 @@ exports.GCNodeType = {
64
64
  Other: "Other",
65
65
  };
66
66
  /** The state of node that is unreferenced. */
67
- const UnreferencedState = {
67
+ exports.UnreferencedState = {
68
68
  /** The node is active, i.e., it can become referenced again. */
69
69
  Active: "Active",
70
70
  /** The node is inactive, i.e., it should not become referenced. */
@@ -87,9 +87,23 @@ class UnreferencedStateTracker {
87
87
  this.unreferencedTimestampMs = unreferencedTimestampMs;
88
88
  this.inactiveTimeoutMs = inactiveTimeoutMs;
89
89
  this.sweepTimeoutMs = sweepTimeoutMs;
90
- this._state = UnreferencedState.Active;
91
- // If there is no current reference timestamp, don't track the node's unreferenced state. This will happen
92
- // later when updateTracking is called with a reference timestamp.
90
+ this._state = exports.UnreferencedState.Active;
91
+ if (this.sweepTimeoutMs !== undefined) {
92
+ (0, common_utils_1.assert)(this.inactiveTimeoutMs <= this.sweepTimeoutMs, 0x3b0 /* inactive timeout must not be greater than the sweep timeout */);
93
+ }
94
+ this.sweepTimer = new TimerWithNoDefaultTimeout(() => {
95
+ this._state = exports.UnreferencedState.SweepReady;
96
+ (0, common_utils_1.assert)(!this.inactiveTimer.hasTimer, 0x3b1 /* inactiveTimer still running after sweepTimer fired! */);
97
+ });
98
+ this.inactiveTimer = new TimerWithNoDefaultTimeout(() => {
99
+ this._state = exports.UnreferencedState.Inactive;
100
+ // After the node becomes inactive, start the sweep timer after which the node will be ready for sweep.
101
+ if (this.sweepTimeoutMs !== undefined) {
102
+ this.sweepTimer.restart(this.sweepTimeoutMs - this.inactiveTimeoutMs);
103
+ }
104
+ });
105
+ // If there is no current reference timestamp, can't track the node's unreferenced state at this time.
106
+ // This will happen later when updateTracking is called with a reference timestamp.
93
107
  if (currentReferenceTimestampMs !== undefined) {
94
108
  this.updateTracking(currentReferenceTimestampMs);
95
109
  }
@@ -102,47 +116,34 @@ class UnreferencedStateTracker {
102
116
  const unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;
103
117
  // If the node has been unreferenced for sweep timeout amount of time, update the state to SweepReady.
104
118
  if (this.sweepTimeoutMs !== undefined && unreferencedDurationMs >= this.sweepTimeoutMs) {
105
- this._state = UnreferencedState.SweepReady;
119
+ this._state = exports.UnreferencedState.SweepReady;
106
120
  this.clearTimers();
107
121
  return;
108
122
  }
109
123
  // If the node has been unreferenced for inactive timeoutMs amount of time, update the state to inactive.
110
124
  // Also, start a timer for the sweep timeout.
111
125
  if (unreferencedDurationMs >= this.inactiveTimeoutMs) {
112
- this._state = UnreferencedState.Inactive;
113
- this.clearTimers();
126
+ this._state = exports.UnreferencedState.Inactive;
127
+ this.inactiveTimer.clear();
114
128
  if (this.sweepTimeoutMs !== undefined) {
115
- setLongTimeout(this.sweepTimeoutMs - unreferencedDurationMs, () => { this._state = UnreferencedState.SweepReady; }, (timer) => { this.sweepTimer = timer; });
129
+ this.sweepTimer.restart(this.sweepTimeoutMs - unreferencedDurationMs);
116
130
  }
117
131
  return;
118
132
  }
119
- // The node is still active. Start the inactive timer for the remaining duration.
120
- const remainingDurationMs = this.inactiveTimeoutMs - unreferencedDurationMs;
121
- if (this.inactiveTimer === undefined) {
122
- const inactiveTimeoutHandler = () => {
123
- this._state = UnreferencedState.Inactive;
124
- // After the node becomes inactive, start the sweep timer after which the node will be ready for sweep.
125
- if (this.sweepTimeoutMs !== undefined) {
126
- setLongTimeout(this.sweepTimeoutMs - this.inactiveTimeoutMs, () => { this._state = UnreferencedState.SweepReady; }, (timer) => { this.sweepTimer = timer; });
127
- }
128
- };
129
- this.inactiveTimer = new common_utils_1.Timer(remainingDurationMs, () => inactiveTimeoutHandler());
130
- }
131
- this.inactiveTimer.restart(remainingDurationMs);
133
+ // The node is still active. Ensure the inactive timer is running with the proper remaining duration.
134
+ this.inactiveTimer.restart(this.inactiveTimeoutMs - unreferencedDurationMs);
132
135
  }
133
136
  clearTimers() {
134
- var _a;
135
- (_a = this.inactiveTimer) === null || _a === void 0 ? void 0 : _a.clear();
136
- if (this.sweepTimer !== undefined) {
137
- clearTimeout(this.sweepTimer);
138
- }
137
+ this.inactiveTimer.clear();
138
+ this.sweepTimer.clear();
139
139
  }
140
140
  /** Stop tracking this node. Reset the unreferenced timers and state, if any. */
141
141
  stopTracking() {
142
142
  this.clearTimers();
143
- this._state = UnreferencedState.Active;
143
+ this._state = exports.UnreferencedState.Active;
144
144
  }
145
145
  }
146
+ exports.UnreferencedStateTracker = UnreferencedStateTracker;
146
147
  /**
147
148
  * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
148
149
  * its state across summaries.
@@ -228,7 +229,7 @@ class GarbageCollector {
228
229
  this.gcEnabled = this.gcOptions.gcAllowed !== false;
229
230
  // The sweep phase has to be explicitly enabled by setting the sweepAllowed flag in GC options to true.
230
231
  this.sweepEnabled = this.gcOptions.sweepAllowed === true;
231
- // Set the Session Expiry only if the flag is enabled or the test option is set.
232
+ // Set the Session Expiry only if the flag is enabled and GC is enabled.
232
233
  if (this.mc.config.getBoolean(exports.runSessionExpiryKey) && this.gcEnabled) {
233
234
  this.sessionExpiryTimeoutMs = (_b = this.gcOptions.sessionExpiryTimeoutMs) !== null && _b !== void 0 ? _b : exports.defaultSessionExpiryDurationMs;
234
235
  }
@@ -238,7 +239,8 @@ class GarbageCollector {
238
239
  // If Test Override config is set, override Session Expiry timeout.
239
240
  const overrideSessionExpiryTimeoutMs = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.SessionExpiryMs");
240
241
  const timeoutMs = overrideSessionExpiryTimeoutMs !== null && overrideSessionExpiryTimeoutMs !== void 0 ? overrideSessionExpiryTimeoutMs : this.sessionExpiryTimeoutMs;
241
- setLongTimeout(timeoutMs, () => { this.runtime.closeFn(new container_utils_1.ClientSessionExpiredError(`Client session expired.`, timeoutMs)); }, (timer) => { this.sessionExpiryTimer = timer; });
242
+ this.sessionExpiryTimer = new common_utils_1.Timer(timeoutMs, () => { this.runtime.closeFn(new container_utils_1.ClientSessionExpiredError(`Client session expired.`, timeoutMs)); });
243
+ this.sessionExpiryTimer.start();
242
244
  // TEMPORARY: Hardcode a default of 2 days which is the value used in the ODSP driver.
243
245
  // This unblocks the Sweep Log (see logSweepEvents function).
244
246
  // This will be removed before sweep is fully implemented.
@@ -262,7 +264,7 @@ class GarbageCollector {
262
264
  * 2. GC should not be disabled via disableGC GC option.
263
265
  * These conditions can be overridden via runGCKey feature flag.
264
266
  */
265
- this.shouldRunGC = (_d = this.mc.config.getBoolean(runGCKey)) !== null && _d !== void 0 ? _d : (
267
+ this.shouldRunGC = (_d = this.mc.config.getBoolean(exports.runGCKey)) !== null && _d !== void 0 ? _d : (
266
268
  // GC must be enabled for the document.
267
269
  this.gcEnabled
268
270
  // GC must not be disabled via GC options.
@@ -280,13 +282,13 @@ class GarbageCollector {
280
282
  // && (this.mc.config.getBoolean(runSweepKey) ?? this.sweepEnabled);
281
283
  this.trackGCState = this.mc.config.getBoolean(exports.trackGCStateKey) === true;
282
284
  // Override inactive timeout if test config or gc options to override it is set.
283
- this.inactiveTimeoutMs = (_f = (_e = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs")) !== null && _e !== void 0 ? _e : this.gcOptions.inactiveTimeoutMs) !== null && _f !== void 0 ? _f : defaultInactiveTimeoutMs;
285
+ this.inactiveTimeoutMs = (_f = (_e = this.mc.config.getNumber("Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs")) !== null && _e !== void 0 ? _e : this.gcOptions.inactiveTimeoutMs) !== null && _f !== void 0 ? _f : exports.defaultInactiveTimeoutMs;
284
286
  // Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.
285
287
  if (this.sweepTimeoutMs !== undefined && this.inactiveTimeoutMs > this.sweepTimeoutMs) {
286
- throw new container_utils_1.UsageError("inactive timeout should not be greated than the sweep timeout");
288
+ throw new container_utils_1.UsageError("inactive timeout should not be greater than the sweep timeout");
287
289
  }
288
290
  // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
289
- this.testMode = (_g = this.mc.config.getBoolean(gcTestModeKey)) !== null && _g !== void 0 ? _g : this.gcOptions.runGCInTestMode === true;
291
+ this.testMode = (_g = this.mc.config.getBoolean(exports.gcTestModeKey)) !== null && _g !== void 0 ? _g : this.gcOptions.runGCInTestMode === true;
290
292
  // GC state is written into root of the summary tree by default. Can be overridden via feature flag for now.
291
293
  this._writeDataAtRoot = (_h = this.mc.config.getBoolean(writeAtRootKey)) !== null && _h !== void 0 ? _h : true;
292
294
  if (this._writeDataAtRoot) {
@@ -385,7 +387,7 @@ class GarbageCollector {
385
387
  // each node in the summary.
386
388
  const usedRoutes = (0, garbage_collector_1.runGarbageCollection)(gcNodes, ["/"]).referencedNodeIds;
387
389
  const baseGCDetailsMap = (0, garbage_collector_1.unpackChildNodesGCDetails)({ gcData: { gcNodes }, usedRoutes });
388
- // Currently, the nodes may write the GC data. So, we need to update it's base GC details with the
390
+ // Currently, the nodes may write the GC data. So, we need to update its base GC details with the
389
391
  // unreferenced timestamp. Once we start writing the GC data here, we won't need to do this anymore.
390
392
  for (const [nodeId, nodeData] of Object.entries(baseState.gcNodes)) {
391
393
  if (nodeData.unreferencedTimestampMs !== undefined) {
@@ -596,7 +598,7 @@ class GarbageCollector {
596
598
  return;
597
599
  }
598
600
  const nodeStateTracker = this.unreferencedNodesState.get(nodePath);
599
- if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {
601
+ if (nodeStateTracker && nodeStateTracker.state !== exports.UnreferencedState.Active) {
600
602
  this.inactiveNodeUsed(reason, nodePath, nodeStateTracker, undefined /* fromNodeId */, packagePath, timestampMs, requestHeaders);
601
603
  }
602
604
  }
@@ -616,15 +618,14 @@ class GarbageCollector {
616
618
  outboundRoutes.push(toNodePath);
617
619
  this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);
618
620
  const nodeStateTracker = this.unreferencedNodesState.get(toNodePath);
619
- if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {
621
+ if (nodeStateTracker && nodeStateTracker.state !== exports.UnreferencedState.Active) {
620
622
  this.inactiveNodeUsed("Revived", toNodePath, nodeStateTracker, fromNodePath);
621
623
  }
622
624
  }
623
625
  dispose() {
624
- if (this.sessionExpiryTimer !== undefined) {
625
- clearTimeout(this.sessionExpiryTimer);
626
- this.sessionExpiryTimer = undefined;
627
- }
626
+ var _a;
627
+ (_a = this.sessionExpiryTimer) === null || _a === void 0 ? void 0 : _a.clear();
628
+ this.sessionExpiryTimer = undefined;
628
629
  }
629
630
  /**
630
631
  * Updates the state of the system as per the current GC run. It does the following:
@@ -848,7 +849,7 @@ class GarbageCollector {
848
849
  return;
849
850
  }
850
851
  this.unreferencedNodesState.forEach((nodeStateTracker, nodeId) => {
851
- if (nodeStateTracker.state !== UnreferencedState.SweepReady) {
852
+ if (nodeStateTracker.state !== exports.UnreferencedState.SweepReady) {
852
853
  return;
853
854
  }
854
855
  const nodeType = this.runtime.getNodeType(nodeId);
@@ -879,7 +880,7 @@ class GarbageCollector {
879
880
  // If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip
880
881
  // logging as nothing interesting would have happened worth logging.
881
882
  // If the node is active, skip logging.
882
- if (currentReferenceTimestampMs === undefined || nodeStateTracker.state === UnreferencedState.Active) {
883
+ if (currentReferenceTimestampMs === undefined || nodeStateTracker.state === exports.UnreferencedState.Active) {
883
884
  return;
884
885
  }
885
886
  // For non-summarizer clients, only log "Loaded" type events since these objects may not be loaded in the
@@ -904,7 +905,7 @@ class GarbageCollector {
904
905
  type: nodeType,
905
906
  unrefTime: nodeStateTracker.unreferencedTimestampMs,
906
907
  age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,
907
- timeout: nodeStateTracker.state === UnreferencedState.Inactive
908
+ timeout: nodeStateTracker.state === exports.UnreferencedState.Inactive
908
909
  ? this.inactiveTimeoutMs
909
910
  : this.sweepTimeoutMs,
910
911
  completedGCRuns: this.completedRuns,
@@ -933,7 +934,7 @@ class GarbageCollector {
933
934
  * revived and a Revived event will be logged for it.
934
935
  */
935
936
  const nodeStateTracker = this.unreferencedNodesState.get(eventProps.id);
936
- const active = nodeStateTracker === undefined || nodeStateTracker.state === UnreferencedState.Active;
937
+ const active = nodeStateTracker === undefined || nodeStateTracker.state === exports.UnreferencedState.Active;
937
938
  if ((usageType === "Revived") === active) {
938
939
  const pkg = await this.getNodePackagePath(eventProps.id);
939
940
  const fromPkg = eventProps.fromId ? await this.getNodePackagePath(eventProps.fromId) : undefined;
@@ -976,23 +977,18 @@ function generateSortedGCState(gcState) {
976
977
  }
977
978
  return sortedGCState;
978
979
  }
979
- /**
980
- * setLongTimeout is used for timeouts longer than setTimeout's ~24.8 day max
981
- * @param timeoutMs - the total time the timeout needs to last in ms
982
- * @param timeoutFn - the function to execute when the timer ends
983
- * @param setTimerFn - the function used to update your timer variable
984
- */
985
- function setLongTimeout(timeoutMs, timeoutFn, setTimerFn) {
986
- // The setTimeout max is 24.8 days before looping occurs.
987
- const maxTimeout = 2147483647;
988
- let timer;
989
- if (timeoutMs > maxTimeout) {
990
- const newTimeoutMs = timeoutMs - maxTimeout;
991
- timer = setTimeout(() => setLongTimeout(newTimeoutMs, timeoutFn, setTimerFn), maxTimeout);
980
+ /** A wrapper around common-utils Timer that requires the timeout when calling start/restart */
981
+ class TimerWithNoDefaultTimeout extends common_utils_1.Timer {
982
+ constructor(callback) {
983
+ // The default timeout/handlers will never be used since start/restart pass overrides below
984
+ super(0, () => { throw new Error("DefaultHandler should not be used"); });
985
+ this.callback = callback;
986
+ }
987
+ start(timeoutMs) {
988
+ super.start(timeoutMs, this.callback);
992
989
  }
993
- else {
994
- timer = setTimeout(() => timeoutFn(), timeoutMs);
990
+ restart(timeoutMs) {
991
+ super.restart(timeoutMs, this.callback);
995
992
  }
996
- setTimerFn(timer);
997
993
  }
998
994
  //# sourceMappingURL=garbageCollection.js.map