chainsyncer

Blockchain syncer driver
Log | Files | Refs | LICENSE

commit 5f298cb8047451f818d58f036fd9c1985d876f21
parent f4c69365177d027a6f269667dd3cc00a3fe7c86c
Author: lash <dev@holbrook.no>
Date:   Sat,  2 Apr 2022 11:21:58 +0000

Graceful shutdown of driver

Diffstat:
Mchainsyncer/driver/base.py | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/chainsyncer/driver/base.py b/chainsyncer/driver/base.py @@ -40,6 +40,10 @@ class SyncDriver: self.clock_id = time.CLOCK_MONOTONIC_RAW self.store.connect() 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):