Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions cli/utils/sig.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import signal
import asyncio
import logging
Expand Down Expand Up @@ -33,6 +34,10 @@ async def _signal_handling(
async def _handle_termination_signal(
logger: naz.log.BaseLogger, _signal: "signal.Signals", client: naz.Client
) -> None:
"""
Handle termination signal by cleanly shutting down the `naz` client.
At the end of it, send a `SIGKILL` signal to `naz` to make sure it exists.
"""
logger.log(
logging.INFO,
{
Expand All @@ -49,4 +54,6 @@ async def _handle_termination_signal(
logging.INFO,
{"event": "naz.cli.signals", "stage": "end", "state": "client has succesfully shutdown"},
)

os.kill(client._PID, signal.SIGKILL)
return
1 change: 1 addition & 0 deletions examples/example_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
enquire_link_interval=70.00,
rateLimiter=MyRateLimiter(),
address_range="^254", # any msisdns beginning with 254. See Appendix A of SMPP spec doc
logger=naz.log.SimpleLogger("okayy", naz.log.BreachHandler(capacity=30)),
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@komuw undo this change

)