File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,18 @@ class RtsMon {
4444
4545 const aboveThreshold : boolean = memoryUsageMB >= this . options . thresholdMib ;
4646 if ( aboveThreshold === true ) {
47- this . sendSignal ( pid ) ;
47+ await this . sendSignal ( pid ) ;
4848 this . currentIntervalSeconds *= 2 ;
4949 Program . log (
5050 `RSS ${ memoryUsageMB . toFixed ( 1 ) } MB >= threshold (${ this . options . thresholdMib } MiB). Increasing interval to ${
5151 this . currentIntervalSeconds
5252 } s`
5353 ) ;
5454 } else {
55+ if ( this . currentIntervalSeconds > this . options . intervalSeconds ) {
56+ // Memory usage came back down below the threshold since last check. Collect one more report.
57+ await this . sendSignal ( pid ) ;
58+ }
5559 Program . log ( `RSS ${ memoryUsageMB . toFixed ( 1 ) } MiB (below threshold ${ this . options . thresholdMib } MiB).` ) ;
5660 this . resetDelay ( ) ;
5761 }
@@ -67,9 +71,9 @@ class RtsMon {
6771 this . currentIntervalSeconds = this . options . intervalSeconds ;
6872 }
6973
70- private sendSignal ( pid : number ) : void {
74+ private async sendSignal ( pid : number ) : Promise < void > {
7175 try {
72- this . runCommand ( "kill" , [ "-SIGUSR2" , String ( pid ) ] ) ;
76+ await this . runCommand ( "kill" , [ "-SIGUSR2" , String ( pid ) ] ) ;
7377 Program . log ( `Sent SIGUSR2 to pid ${ pid } ` ) ;
7478 } catch ( e ) {
7579 Program . logError ( `Failed to send SIGUSR2 to pid ${ pid } : ${ ( e as Error ) . message } ` ) ;
You can’t perform that action at this time.
0 commit comments