Skip to content

Commit

Permalink
Merge pull request #2052 from sopel-irc/find_updates-UnboundLocalError
Browse files Browse the repository at this point in the history
find_updates: return in ALL the appropriate failure cases
  • Loading branch information
dgw committed Apr 30, 2021
2 parents 057043a + 8dbce96 commit ed2b825
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sopel/modules/find_updates.py
Expand Up @@ -67,8 +67,14 @@ def check_version(bot):
except ValueError:
# TODO: use JSONDecodeError when dropping Pythons < 3.5
_check_failed(bot)
success = False

if not success and bot.memory.get('update_failures', 0) > 4:
if not success:
if bot.memory.get('update_failures', 0) <= 4:
# not enough failures to worry; silently ignore this one
return

# too many failures to ignore; notify owner
bot.say(
"[update] I haven't been able to check for updates in a while. "
"Please verify that {} is working and I can reach it."
Expand Down

0 comments on commit ed2b825

Please sign in to comment.