zmirror: Allow duplicate zmirror processes to die gracefully.
Fixes #602. I replaced the SIGKILL with a SIGINT, and then catch SIGINT with a handler. This handler calls cancelSubs if necessary, and can later be edited to perform other clean-up operations, too. I thought about, in this same commit, changing the SIGTERM in maybe_restart_mirroring_script to a SIGINT, but after tracing out the code paths, I realized that isn't necessary. (The SIGTERM is necessarily performed on a process that has not subscribed to any zephyr classes, so cancelSubs is unnecessary. If we do think that we may want to add additional clean-up operations in the future, though, then it might be worth investigating changing this SIGTERM.) (imported from commit 692b295be6cb40b0e4ec2ca0bc58c58056ed9bd9)
This commit is contained in:
parent
bd3bd8ca44
commit
9ebfa84385
2 changed files with 33 additions and 1 deletions
|
@ -27,9 +27,16 @@ import time
|
|||
import optparse
|
||||
import os
|
||||
import traceback
|
||||
import signal
|
||||
|
||||
from zephyr_mirror_backend import parse_args
|
||||
|
||||
def die(signal, frame):
|
||||
# We actually want to exit, so run os._exit (so as not to be caught and restarted)
|
||||
os._exit(1)
|
||||
|
||||
signal.signal(signal.SIGINT, die)
|
||||
|
||||
(options, args) = parse_args()
|
||||
|
||||
args = [os.path.join(options.root_path, "user_root", "zephyr_mirror_backend.py")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue