File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 55import asyncio
66import config
77
8+ import signal
9+ import sys
10+
811from multiprocessing import Process , Manager
912from multiprocessing .managers import BaseManager
1013from . import db
@@ -237,17 +240,21 @@ def fs_down_callback(self, data):
237240 continue
238241
239242
240- def start_comms ():
241- # # create shared telemetry object instance
242- # BaseManager.register('Telemetry', Telemetry)
243- # manager = BaseManager()
244- # manager.start()
245- # inst = manager.Telemetry()
246243
247- telemetry = Telemetry ()
244+ telemetry = Telemetry ()
245+ p = Process (target = sync , args = [telemetry .fs_down_callback ])
246+
247+ # kill child process when parent received SIGINT
248+ def sigint_handler (signal , frame ):
249+ # must send SIGKILL because child process ignores SIGTERM for unknown reasons
250+ # TODO fix this?????????
251+ p .kill ()
252+ sys .exit (0 )
248253
254+ signal .signal (signal .SIGINT , sigint_handler )
255+
256+ def start_comms ():
249257 # start file sync
250- p = Process (target = sync , args = [telemetry .fs_down_callback ], daemon = True )
251258 p .start ()
252259
253260 set_format (config .DATAFORMAT_PATH )
You can’t perform that action at this time.
0 commit comments