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()
except KeyboardInterrupt:
WebSocketConnection.closeAll()
Services.stop()

View File

@ -369,12 +369,19 @@ class AprsHandler(object):
class Services(object):
handlers = []
@staticmethod
def start():
if not PropertyManager.getSharedInstance()["services_enabled"]:
return
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):