2525// --advisories=FILE path to a JSON array of {advisoryId, package, ecosystem} —
2626// jobs round-robin across these instead of all hitting the
2727// same package (default: a single lodash advisory, repeated)
28-
2928import { execSync } from 'child_process'
3029import * as fs from 'fs'
3130
@@ -84,9 +83,7 @@ function applyRunConfig() {
8483 // cgroup cap above, which docker update can patch live) — they're baked in at
8584 // container start. Verify the worker already has the value this run wants
8685 // instead of silently testing against whatever it happened to start with.
87- const actual = sh (
88- `docker exec ${ CONTAINER } sh -c 'echo $BLAST_RADIUS_SCAN_CONCURRENCY'` ,
89- )
86+ const actual = sh ( `docker exec ${ CONTAINER } sh -c 'echo $BLAST_RADIUS_SCAN_CONCURRENCY'` )
9087 if ( actual !== SCAN_CONCURRENCY ) {
9188 throw new Error (
9289 `--scanConcurrency=${ SCAN_CONCURRENCY } requested but ${ CONTAINER } was started with ` +
@@ -114,9 +111,7 @@ function resetRunConfig() {
114111
115112function sampleContainerStats ( ) : { memUsage : string ; cpuPerc : string } | null {
116113 try {
117- const raw = sh (
118- `docker stats ${ CONTAINER } --no-stream --format "{{.MemUsage}}|{{.CPUPerc}}"` ,
119- )
114+ const raw = sh ( `docker stats ${ CONTAINER } --no-stream --format "{{.MemUsage}}|{{.CPUPerc}}"` )
120115 const [ memUsage , cpuPerc ] = raw . split ( '|' )
121116 return { memUsage, cpuPerc }
122117 } catch {
@@ -190,7 +185,9 @@ async function main() {
190185 } ) ,
191186 )
192187
193- console . log ( `[loadtest] submitted ${ analysisIds . length } analyses in ${ Date . now ( ) - submittedAt } ms` )
188+ console . log (
189+ `[loadtest] submitted ${ analysisIds . length } analyses in ${ Date . now ( ) - submittedAt } ms` ,
190+ )
194191 console . log ( `[loadtest] analysisIds: ${ analysisIds . join ( ', ' ) } ` )
195192
196193 const deadline = Date . now ( ) + TIMEOUT_MS
@@ -229,7 +226,9 @@ async function main() {
229226 allDone = true
230227 break
231228 }
232- await new Promise ( ( resolve ) => setTimeout ( resolve , POLL_INTERVAL_MS ) )
229+ await new Promise ( ( resolve ) => {
230+ setTimeout ( resolve , POLL_INTERVAL_MS )
231+ } )
233232 }
234233
235234 if ( ! allDone ) {
@@ -246,15 +245,20 @@ async function main() {
246245 for ( const id of analysisIds ) {
247246 const runs = stageRuns . filter ( ( r : { analysis_id : string } ) => r . analysis_id === id )
248247 const summary = runs
249- . map ( ( r : { stage : string ; status : string ; error : string | null } ) => `${ r . stage } =${ r . status } ${ r . error ? ` (${ r . error } )` : '' } ` )
248+ . map (
249+ ( r : { stage : string ; status : string ; error : string | null } ) =>
250+ `${ r . stage } =${ r . status } ${ r . error ? ` (${ r . error } )` : '' } ` ,
251+ )
250252 . join ( ', ' )
251253 console . log ( `${ id } : ${ summary || 'no stage runs recorded' } ` )
252254 }
253255
254256 console . log ( '\n=== Stage duration stats (ms) ===' )
255257 for ( const stage of [ 'intel' , 'dependents' , 'reachability' , 'report' ] ) {
256258 const durations = stageRuns
257- . filter ( ( r : { stage : string ; status : string } ) => r . stage === stage && r . status === 'succeeded' )
259+ . filter (
260+ ( r : { stage : string ; status : string } ) => r . stage === stage && r . status === 'succeeded' ,
261+ )
258262 . map ( ( r : { duration_ms : number | string } ) => Number ( r . duration_ms ) )
259263 console . log ( `${ stage } :` , stats ( durations ) )
260264 }
0 commit comments