Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

chore: fix internal attribute naming in SystemStatus (#2373)

Vlada Dusek8ba0f3095ee3
diff --git a/packages/core/src/autoscaling/system_status.ts b/packages/core/src/autoscaling/system_status.ts
index bff2a1252..a2a74d438 100644
--- a/packages/core/src/autoscaling/system_status.ts
+++ b/packages/core/src/autoscaling/system_status.ts
@@ -118,7 +118,7 @@ export interface FinalStatistics {
* @category Scaling
*/
export class SystemStatus {
- private readonly currentHistorySecs: number;
+ private readonly currentHistoryMillis: number;
private readonly maxMemoryOverloadedRatio: number;
private readonly maxEventLoopOverloadedRatio: number;
private readonly maxCpuOverloadedRatio: number;
@@ -146,7 +146,7 @@ export class SystemStatus {
config,
} = options;
- this.currentHistorySecs = currentHistorySecs * 1000;
+ this.currentHistoryMillis = currentHistorySecs * 1000;
this.maxMemoryOverloadedRatio = maxMemoryOverloadedRatio;
this.maxEventLoopOverloadedRatio = maxEventLoopOverloadedRatio;
this.maxCpuOverloadedRatio = maxCpuOverloadedRatio;
@@ -171,7 +171,7 @@ export class SystemStatus {
* and `true` otherwise.
*/
getCurrentStatus(): SystemInfo {
- return this._isSystemIdle(this.currentHistorySecs);
+ return this._isSystemIdle(this.currentHistoryMillis);
}
/**
diff --git a/test/core/autoscaling/system_status.test.ts b/test/core/autoscaling/system_status.test.ts
index 4afe7b866..504cca2f0 100644
--- a/test/core/autoscaling/system_status.test.ts
+++ b/test/core/autoscaling/system_status.test.ts
@@ -168,17 +168,17 @@ describe('SystemStatus', () => {
});
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 5;
+ systemStatus.currentHistoryMillis = 5;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(false);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(true);
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 10;
+ systemStatus.currentHistoryMillis = 10;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(false);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(true);
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 12;
+ systemStatus.currentHistoryMillis = 12;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(true);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(true);
@@ -192,17 +192,17 @@ describe('SystemStatus', () => {
});
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 5;
+ systemStatus.currentHistoryMillis = 5;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(true);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(false);
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 10;
+ systemStatus.currentHistoryMillis = 10;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(true);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(false);
// @ts-expect-error Overwriting readonly private prop
- systemStatus.currentHistorySecs = 12;
+ systemStatus.currentHistoryMillis = 12;
expect(systemStatus.getCurrentStatus().isSystemIdle).toBe(false);
expect(systemStatus.getHistoricalStatus().isSystemIdle).toBe(false);
});