Worlcup module: add a timeout to urlopen to avoid infinite event

This commit is contained in:
nemunaire 2014-07-17 12:04:34 +02:00
parent ba1b5774bb
commit 82198160fd

View File

@ -16,7 +16,7 @@ def load(context):
add_hook("cmd_hook", Hook(cmd_worldcup, "worldcup")) add_hook("cmd_hook", Hook(cmd_worldcup, "worldcup"))
from event import ModuleEvent from event import ModuleEvent
add_event(ModuleEvent(func=lambda url: urlopen(url).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, intervalle=30)) add_event(ModuleEvent(func=lambda url: urlopen(url, timeout=10).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, intervalle=30))
def help_tiny (): def help_tiny ():