From dedeae21116c887d75126a9b151acc0cc27ce345 Mon Sep 17 00:00:00 2001 From: ultra Date: Mon, 13 Mar 2017 16:08:45 -0400 Subject: [PATCH] Prevent background thread from dying on an exception Add mobile web support --- views/index.tpl | 1 + web.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/views/index.tpl b/views/index.tpl index 2c46e99..e657e59 100644 --- a/views/index.tpl +++ b/views/index.tpl @@ -12,6 +12,7 @@ }); }); +
diff --git a/web.py b/web.py index bead3be..db18dae 100644 --- a/web.py +++ b/web.py @@ -32,6 +32,12 @@ def import_data(): # import_data() clf = Classifier(grab_all_data) +def tryUpdateHN(): + try: + updateHN() + except Exception, e: + print e + @bottle.route("/update") def updateHN(): print "Updating HN..." @@ -120,7 +126,7 @@ def rate(id): bottle.redirect("/") if __name__ == "__main__": - schedule.every(10).minutes.do(updateHN) + schedule.every(10).minutes.do(tryUpdateHN) st = SchedThread() #st.daemon = True st.start()