Skip to content

Commit

Permalink
Truncate metrics file to 10MB. #8
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Feb 28, 2023
1 parent 79f90da commit 4063faf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/saturn-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { execa } from 'execa'
import { join, dirname } from 'node:path'
import { arch, platform } from 'node:os'
import { fetch } from 'undici'
import bytes from 'bytes'

const modules = join(dirname(fileURLToPath(import.meta.url)), '..', 'modules')
const archOverwritten = platform() === 'darwin' ? 'x64' : arch()
Expand Down Expand Up @@ -131,6 +132,7 @@ async function pollStats ({ ROOT, apiUrl }) {
join(ROOT, 'logs', 'metrics.log'),
formatLog(`${JSON.stringify({ totalJobsCompleted })}\n`)
)
await fs.truncate(join(ROOT, 'logs', 'metrics.log'), bytes('10mb'))
}

function noop () {
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"unzip-stream": "^0.3.1"
},
"dependencies": {
"bytes": "^3.1.2",
"execa": "^7.0.0",
"undici": "^5.20.0"
}
Expand Down

0 comments on commit 4063faf

Please sign in to comment.