Skip to content

Commit

Permalink
reapply fix: interrupt during disconnected phase (9dd772d)
Browse files Browse the repository at this point in the history
Because of 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. Reapplied because of changes from #1493.
  • Loading branch information
HumorBaby committed Apr 16, 2019
1 parent f694b5b commit ec9eeb7
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 ec9eeb7

Please sign in to comment.