add signal handler for SIGINT, SIGTERM and SIGABRT

This commit is contained in:
gcarq
2017-10-27 15:52:14 +02:00
parent 0c33e917d5
commit 4139b0b0c7
3 changed files with 38 additions and 4 deletions

View File

@@ -37,6 +37,14 @@ def init(config: dict, db_url: Optional[str] = None) -> None:
Base.metadata.create_all(engine)
def cleanup() -> None:
"""
Flushes all pending operations to disk.
:return: None
"""
Trade.session.flush()
class Trade(Base):
__tablename__ = 'trades'