MCPcopy
hub / github.com/apify/crawlee / push

Method push

packages/core/src/autoscaling/load_signal.ts:64–75  ·  view source on GitHub ↗

* Add a snapshot and prune entries older than the history window.

(snapshot: T, now: Date = snapshot.createdAt)

Source from the content-addressed store, hash-verified

62 * Add a snapshot and prune entries older than the history window.
63 */
64 push(snapshot: T, now: Date = snapshot.createdAt): void {
65 // Inline pruning to avoid private-method transpilation issues
66 let oldCount = 0;
67 for (let i = 0; i < this.snapshots.length; i++) {
68 const { createdAt } = this.snapshots[i];
69 if (now.getTime() - new Date(createdAt).getTime() > this.historyMillis) oldCount++;
70 else break;
71 }
72 if (oldCount) this.snapshots.splice(0, oldCount);
73
74 this.snapshots.push(snapshot);
75 }
76
77 /**
78 * Return all snapshots, or only those within the given time window.

Callers 15

sitemap.test.tsFile · 0.80
extractUrlsFunction · 0.80
chunkFunction · 0.80
chunkedAsyncIterableFunction · 0.80
processBufferMethod · 0.80
onCloseTagMethod · 0.80
onTextMethod · 0.80
parseSitemapFunction · 0.80
tryCommonNamesMethod · 0.80
parseMethod · 0.80
discoverValidSitemapsFunction · 0.80
emailsFromUrlsFunction · 0.80

Calls

no outgoing calls

Tested by 15

createRequestQueueMockFunction · 0.64
createRequestQueueMockFunction · 0.64
createRequestQueueMockFunction · 0.64
createRequestQueueMockFunction · 0.64
createRequestQueueMockFunction · 0.64
runTaskFunctionFunction · 0.64
setFunction · 0.64
generateSnapsSyncFunction · 0.64
requestHandlerFunction · 0.64
streamFunction · 0.64
requestHandlerFunction · 0.64