File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ def teardown_request(current_app):
4343
4444
4545def kill_task (current_app ):
46- DESKTOP_APP = bool (current_app .config .get ("DESKTOP_APP" ))
4746 REQUEST_COUNTER = int (current_app .config .get ("REQUEST_COUNTER" ))
4847 LAST_PING_TIME = float (current_app .config .get ("LAST_PING_TIME" ))
4948 LAST_REQUEST_TIME = float (current_app .config .get ("LAST_REQUEST_TIME" ))
@@ -52,16 +51,20 @@ def kill_task(current_app):
5251 minutes_since_last_request = (current_time - LAST_REQUEST_TIME ) / 60
5352 minutes_since_last_ping = (current_time - LAST_PING_TIME ) / 60
5453
55- if (
56- (
57- ( minutes_since_last_request > MINUTES_BEFORE_TIMEOUT )
58- and ( DESKTOP_APP == False )
59- )
60- or ( minutes_since_last_ping > MINUTES_BEFORE_TIMEOUT )
61- ) and ( REQUEST_COUNTER == 0 ):
62- print ( "Server timed out due to inactivity, shutting down..." , flush = True )
63- os . _exit ( 0 )
54+ if (REQUEST_COUNTER > 0 ):
55+ return
56+ if MINUTES_BEFORE_TIMEOUT == 0 :
57+ return
58+ if ( minutes_since_last_ping > MINUTES_BEFORE_TIMEOUT ):
59+ kill_server ( )
60+ if ( minutes_since_last_request > MINUTES_BEFORE_TIMEOUT ):
61+ kill_server ( )
62+
6463
64+ def kill_server ():
65+ print ("Server timed out due to inactivity, shutting down..." , flush = True )
66+ os ._exit (0 )
67+
6568
6669def versions (list_packages : list ):
6770 list_with_versions = []
You can’t perform that action at this time.
0 commit comments