Fixing nohup issue
This commit is contained in:
parent
a22fe1b9e7
commit
432a8b2059
@ -465,11 +465,15 @@ class XMPPClient(ClientXMPP):
|
|||||||
async def _run(self):
|
async def _run(self):
|
||||||
self._stopped = asyncio.Event()
|
self._stopped = asyncio.Event()
|
||||||
self._loop = asyncio.get_running_loop()
|
self._loop = asyncio.get_running_loop()
|
||||||
for sig in (signal.SIGTERM, signal.SIGHUP):
|
|
||||||
try:
|
# Hanya tangani SIGTERM untuk shutdown.
|
||||||
self._loop.add_signal_handler(sig, self._stopped.set)
|
# SENGATKAN SIGHUP: nohup kirim SIGHUP saat terminal close,
|
||||||
except NotImplementedError:
|
# dan kita tidak mau proses mati karena itu.
|
||||||
pass
|
try:
|
||||||
|
self._loop.add_signal_handler(signal.SIGTERM, self._stopped.set)
|
||||||
|
except NotImplementedError:
|
||||||
|
pass
|
||||||
|
|
||||||
await self.connect()
|
await self.connect()
|
||||||
try:
|
try:
|
||||||
await self._stopped.wait()
|
await self._stopped.wait()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user