mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
work on server shutdown..
This commit is contained in:
parent
5152161649
commit
fa6e591ca9
2 changed files with 15 additions and 8 deletions
|
@ -7,6 +7,8 @@ from message_system_db_messages import DatabaseManagerMessages
|
|||
from message_system_db_beacon import DatabaseManagerBeacon
|
||||
import explorer
|
||||
import command_beacon
|
||||
import atexit
|
||||
|
||||
|
||||
|
||||
class ScheduleManager:
|
||||
|
@ -39,7 +41,7 @@ class ScheduleManager:
|
|||
"""Start scheduling events and run the scheduler in a separate thread."""
|
||||
|
||||
# wait some time
|
||||
threading.Event().wait(timeout=10)
|
||||
#threading.Event().wait(timeout=10)
|
||||
|
||||
# get actual freedata_server instance
|
||||
self.modem = modem
|
||||
|
|
|
@ -26,6 +26,7 @@ import command_arq_raw
|
|||
import command_message_send
|
||||
import event_manager
|
||||
import atexit
|
||||
import threading
|
||||
|
||||
from message_system_db_manager import DatabaseManager
|
||||
from message_system_db_messages import DatabaseManagerMessages
|
||||
|
@ -345,14 +346,17 @@ def sock_states(sock):
|
|||
def stop_server():
|
||||
print("------------------------------------------")
|
||||
# TODO This is causing problems for some reasons.
|
||||
#if "service_manager" :
|
||||
# app.service_manager.modem_service.put("stop")
|
||||
# if app.socket_interface_manager:
|
||||
# app.socket_interface_manager.stop_servers()
|
||||
if hasattr(app, 'service_manager'):
|
||||
if hasattr(app, 'socket_interface_manager') and app.socket_interface_manager:
|
||||
app.socket_interface_manager.stop_servers()
|
||||
|
||||
# if app.service_manager.modem:
|
||||
# app.service_manager.modem.sd_input_stream.stop
|
||||
#time.sleep(1)
|
||||
if hasattr(app.service_manager, 'modem_service') and app.service_manager.modem_service:
|
||||
app.service_manager.modem_service.put("stop")
|
||||
|
||||
if hasattr(app.service_manager, 'modem') and app.service_manager.modem:
|
||||
app.service_manager.modem.sd_input_stream.stop
|
||||
|
||||
threading.Event().wait(2)
|
||||
|
||||
def main():
|
||||
app.config['SOCK_SERVER_OPTIONS'] = {'ping_interval': 10}
|
||||
|
@ -395,5 +399,6 @@ def main():
|
|||
|
||||
app.run(modemaddress, modemport, debug=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue