Skip to content

Commit b609bf4

Browse files
committed
Handle SIGTERM signal
1 parent 71a28f1 commit b609bf4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import logging
44
import os
5+
import signal
6+
import sys
57

68
import docker_plugin_api.Plugin
79
import flask
@@ -20,4 +22,5 @@
2022
if os.environ.get('ENVIRONMENT', 'dev') == 'dev':
2123
app.run(debug=True)
2224
else:
25+
signal.signal(signal.SIGTERM, lambda: sys.exit(0))
2326
waitress.serve(app, unix_socket='/run/docker/plugins/pyveth.sock', threads=1)

0 commit comments

Comments
 (0)