Skip to content

Commit

Permalink
reword logging statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Jan 6, 2025
1 parent b0976b3 commit ec3abbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/shared/utilities/processUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export interface ProcessStats {
cpu: number
}
export class ChildProcessTracker {
static readonly pollingInterval: number = 10000
static readonly pollingInterval: number = 10000 // Check usage every 10 seconds
static readonly thresholds: ProcessStats = {
memory: 100 * 1024 * 1024, // 100 MB
cpu: 50,
Expand Down Expand Up @@ -106,7 +106,7 @@ export class ChildProcessTracker {
}
const stats = await this.getUsage(pid)
if (stats) {
ChildProcessTracker.logger.debug(`stats for ${pid}: %O`, stats)
ChildProcessTracker.logger.debug(`Process ${pid} usage: %O`, stats)
if (stats.memory > ChildProcessTracker.thresholds.memory) {
ChildProcessTracker.logger.warn(`Process ${pid} exceeded memory threshold: ${stats.memory}`)
}
Expand All @@ -127,7 +127,7 @@ export class ChildProcessTracker {
this.#pids.delete(childProcessId)
}

public size() {
public get size() {
return this.#pids.size
}

Expand Down Expand Up @@ -271,7 +271,7 @@ export class ChildProcess {
const args = this.#args.concat(options.extraArgs ?? [])

const debugDetail = this.#log.logLevelEnabled('debug')
? ` (running processes: ${ChildProcess.#runningProcesses.size()})`
? ` (running processes: ${ChildProcess.#runningProcesses.size})`
: ''
this.#log.info(`Command: ${this.toString(options.logging === 'noparams')}${debugDetail}`)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ describe('ChildProcessTracker', function () {
'second process was not removed after stopping it'
)

assert.strictEqual(tracker.size(), 0, 'expected tracker to be empty')
assert.strictEqual(tracker.size, 0, 'expected tracker to be empty')
})

it('logs a warning message when system usage exceeds threshold', async function () {
Expand Down

0 comments on commit ec3abbf

Please sign in to comment.