Skip to content

Commit

Permalink
fix: interrupt during disconnected phase
Browse files Browse the repository at this point in the history
Because the `time.sleep` during the disconnect phase, the signal
handling is thrown off and a new bot is spawned before the `bot.hasquit`
flag can be checked. Add a check at the top of the loop to see if the
`hasquit` flag was set during a disconnect.

Fixes #1478
  • Loading branch information
HumorBaby committed Apr 14, 2019
1 parent f694b5b commit 7a3d66a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sopel/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def signal_handler(sig, frame):
tools.stderr('Got restart signal.')
p.restart('Restarting')

# Define empty variable `p` for bot
p = None
while True:
if p and p.hasquit: # Check if `hasquit` was set for bot during disconnected phase
break
try:
p = bot.Sopel(config, daemon=daemon)
if hasattr(signal, 'SIGUSR1'):
Expand Down

0 comments on commit 7a3d66a

Please sign in to comment.