Graceful shutdown of driver

This commit is contained in:
lash 2022-04-02 11:21:58 +00:00
parent f4c6936517
commit 5f298cb804
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -40,6 +40,10 @@ class SyncDriver:
self.clock_id = time.CLOCK_MONOTONIC_RAW self.clock_id = time.CLOCK_MONOTONIC_RAW
self.store.connect() self.store.connect()
self.store.start(offset=offset, target=target) self.store.start(offset=offset, target=target)
if not SyncDriver.signal_set:
for sig in SyncDriver.signal_request:
signal.signal(sig, self.__sig_terminate)
SyncDriver.signal_set = True
def __sig_terminate(self, sig, frame): def __sig_terminate(self, sig, frame):