openreplay/ee/connectors/utils/signal_handler.py
MauricioGarciaS 1a414d5764
fix(connector): Added checkpoints and sigterm handler (#1234)
* fix(connector): fixed bug of cache dict size error

* fix(connector): Added method to save state in s3 for redshift if sigterm arise

* fix(connector): Added exit signal handler and checkpoint method

* Added sslmode selection for connection to database, added use_ssl parameter for S3 connection
2023-05-09 11:35:50 +02:00

14 lines
383 B
Python

import signal
class SignalHandler:
KEEP_PROCESSING = True
def __init__(self):
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.signal(signal.SIGTERM, self.exit_gracefully)
def exit_gracefully(self, signum, frame):
print(f"Exiting gracefully with signal {signum}")
self.KEEP_PROCESSING = False
signal_handler = SignalHandler()