forked from LBRYCommunity/lbry-sdk
dont ignore SIGTERM/SIGINT when already shutting down
This commit is contained in:
parent
cc5b626a54
commit
ddcf3a47f8
1 changed files with 9 additions and 0 deletions
|
@ -8,6 +8,7 @@ import urllib
|
|||
import json
|
||||
import textwrap
|
||||
import random
|
||||
import signal
|
||||
|
||||
from twisted.web import server
|
||||
from twisted.internet import defer, threads, error, reactor
|
||||
|
@ -385,7 +386,15 @@ class Daemon(AuthJSONRPCServer):
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _already_shutting_down(sig_num, frame):
|
||||
log.info("Already shutting down")
|
||||
|
||||
def _shutdown(self):
|
||||
# ignore INT/TERM signals once shutdown has started
|
||||
signal.signal(signal.SIGINT, self._already_shutting_down)
|
||||
signal.signal(signal.SIGTERM, self._already_shutting_down)
|
||||
|
||||
log.info("Closing lbrynet session")
|
||||
log.info("Status at time of shutdown: " + self.startup_status[0])
|
||||
self.looping_call_manager.shutdown()
|
||||
|
|
Loading…
Reference in a new issue