shutdown services properly

This commit is contained in:
Jakob Ketterl 2019-10-27 12:16:17 +01:00
parent 13f27a76ff
commit a24cb3e04a
2 changed files with 9 additions and 1 deletions

View File

@ -60,3 +60,4 @@ if __name__ == "__main__":
main() main()
except KeyboardInterrupt: except KeyboardInterrupt:
WebSocketConnection.closeAll() WebSocketConnection.closeAll()
Services.stop()

View File

@ -369,12 +369,19 @@ class AprsHandler(object):
class Services(object): class Services(object):
handlers = []
@staticmethod @staticmethod
def start(): def start():
if not PropertyManager.getSharedInstance()["services_enabled"]: if not PropertyManager.getSharedInstance()["services_enabled"]:
return return
for source in SdrService.getSources().values(): for source in SdrService.getSources().values():
ServiceHandler(source) Services.handlers.append(ServiceHandler(source))
@staticmethod
def stop():
for handler in Services.handlers:
handler.stopServices()
Services.handlers = []
class Service(object): class Service(object):