File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,10 @@ def DiskStats():
125
125
@async_job ("Queue_Handler" )
126
126
@schedule (timedelta (milliseconds = 1 ).total_seconds ())
127
127
def QueueHandler ():
128
+ # Do next action waiting in the queue
128
129
global STOPPING
129
-
130
130
if STOPPING :
131
- # Empty the message queue to allow program to exit cleanly
131
+ # Empty the action queue to allow program to exit cleanly
132
132
while not config .update_queue .empty ():
133
133
f , args = config .update_queue .get ()
134
134
f (* args )
Original file line number Diff line number Diff line change 21
21
if __name__ == "__main__" :
22
22
23
23
def sighandler (signum , frame ):
24
- print (" Caught signal " , str (signum ), ", exiting" )
24
+ print (" Caught signal" , str (signum ), ", exiting" )
25
25
26
26
# Do not stop the program now in case data transmission was in progress
27
- # Instead, ask the scheduler to finish its current task before stopping
27
+ # Instead, ask the scheduler to empty the action queue before stopping
28
28
scheduler .STOPPING = True
29
29
30
- print ("Waiting for all pending request to be sent to display..." )
30
+ # Allow 5 seconds max. delay in case scheduler is not responding
31
+ wait_time = 5
32
+ print ("Waiting for all pending request to be sent to display (%ds max)..." % wait_time )
31
33
32
- # Allow 2 seconds max. delay in case scheduler is not responding
33
- wait_time = 2
34
34
while not scheduler .is_queue_empty () and wait_time > 0 :
35
35
time .sleep (0.1 )
36
36
wait_time = wait_time - 0.1
37
37
38
+ print ("(%.1fs)" % (5 - wait_time ))
39
+
38
40
# We force the exit to avoid waiting for other scheduled tasks: they may have a long delay!
39
41
try :
40
42
sys .exit (0 )
You can’t perform that action at this time.
0 commit comments