File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,26 +21,28 @@ export class Heart {
2121 * activity. Failures are logged as warnings.
2222 */
2323 public beat ( ) : void {
24- if ( ! this . alive ( ) ) {
25- logger . trace ( "heartbeat" )
26- fs . writeFile ( this . heartbeatPath , "" ) . catch ( ( error ) => {
27- logger . warn ( error . message )
28- } )
29- this . lastHeartbeat = Date . now ( )
30- if ( typeof this . heartbeatTimer !== "undefined" ) {
31- clearTimeout ( this . heartbeatTimer )
32- }
33- this . heartbeatTimer = setTimeout ( ( ) => {
34- this . isActive ( )
35- . then ( ( active ) => {
36- if ( active ) {
37- this . beat ( )
38- }
39- } )
40- . catch ( ( error ) => {
41- logger . warn ( error . message )
42- } )
43- } , this . heartbeatInterval )
24+ if ( this . alive ( ) ) {
25+ return
4426 }
27+
28+ logger . trace ( "heartbeat" )
29+ fs . writeFile ( this . heartbeatPath , "" ) . catch ( ( error ) => {
30+ logger . warn ( error . message )
31+ } )
32+ this . lastHeartbeat = Date . now ( )
33+ if ( typeof this . heartbeatTimer !== "undefined" ) {
34+ clearTimeout ( this . heartbeatTimer )
35+ }
36+ this . heartbeatTimer = setTimeout ( ( ) => {
37+ this . isActive ( )
38+ . then ( ( active ) => {
39+ if ( active ) {
40+ this . beat ( )
41+ }
42+ } )
43+ . catch ( ( error ) => {
44+ logger . warn ( error . message )
45+ } )
46+ } , this . heartbeatInterval )
4547 }
4648}
You can’t perform that action at this time.
0 commit comments