Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Catch KeyboardInterrupt + log on startup #66

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions starknet_devnet/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
A server exposing Starknet functionalities as API endpoints.
"""

import os
import sys
import meinheld
import dill as pickle
Expand All @@ -28,11 +27,6 @@
def main():
"""Runs the server."""

# pylint: disable=global-statement, invalid-name

# reduce startup logging
os.environ["WERKZEUG_RUN_MAIN"] = "true"

args = parse_args()

# Uncomment this once fork support is added
Expand All @@ -57,7 +51,10 @@ def main():

try:
meinheld.listen((args.host, args.port))
print(f" * Listening on http://{args.host}:{args.port}/ (Press CTRL+C to quit)")
meinheld.run(app)
except KeyboardInterrupt:
pass
finally:
if args.dump_on == DumpOn.EXIT:
state.dumper.dump()
Expand Down