File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,18 @@ function updateAndSchedule(state) {
8989function start ( ) {
9090 console . log ( 'pi-clock started' ) ;
9191 var state = initialize ( ) ;
92+ setInterval ( function ( ) { } , 10 * 60 * 1000 ) ;
9293 updateAndSchedule ( state ) ;
9394}
94- start ( ) ;
95+ if ( process . argv [ 2 ] == undefined ) {
96+ start ( ) ;
97+ }
98+ else if ( process . argv [ 2 ] == "test" ) {
99+ test ( ) ;
100+ }
101+ else {
102+ console . log ( "Invalid arg" ) ;
103+ }
95104process . on ( 'SIGINT' , function ( ) {
96105 console . log ( 'terminated' ) ;
97106 sleepLED . unexport ( ) ;
Original file line number Diff line number Diff line change @@ -81,10 +81,23 @@ function updateAndSchedule(state) {
8181function start ( ) {
8282 console . log ( 'pi-clock started' ) ;
8383 let state = initialize ( ) ;
84+
85+ // Prevent setTimeout from suspending by doing something every 10 minutes
86+ setInterval ( ( ) => { } , 10 * 60 * 1000 ) ;
87+
8488 updateAndSchedule ( state ) ;
8589}
8690
87- start ( )
91+ if ( process . argv [ 2 ] == undefined ) {
92+ start ( ) ;
93+ }
94+ else if ( process . argv [ 2 ] == "test" ) {
95+ test ( ) ;
96+ }
97+ else {
98+ console . log ( "Invalid arg" ) ;
99+ }
100+
88101
89102process . on ( 'SIGINT' , function ( ) {
90103 console . log ( 'terminated' ) ;
You can’t perform that action at this time.
0 commit comments