Browse Source

Small fixes in heartbeat

Ralfp 12 years ago
parent
commit
92c17541a4
2 changed files with 6 additions and 7 deletions
  1. 1 1
      cron.txt
  2. 5 6
      heartbeat.py

+ 1 - 1
cron.txt

@@ -9,4 +9,4 @@
 10 3 * * * python $HOME/misago/manage.py updateranking
 25 3 * * * python $HOME/misago/manage.py updatethreadranking
 # Uncomment next line for heartbeat cron
-#3 * * * * python $HOME/misago/heartbeat.py --log=heartbeats.txt
+#3 * * * * python $HOME/misago/heartbeat.py deployment.settings --log=heartbeats.txt

+ 5 - 6
heartbeat.py

@@ -9,12 +9,11 @@ except ImportError:
 
 
 def log_entry(logfile, response=None):
-    if response.time > 1:
-        stopwatch = '%ss' % round(response.time, 3)
-    else:
-        stopwatch = '%sms' % int(response.time * 1000)
-
-    if response and response.code == 200:
+    if response and response.getcode() == 200:
+        if response.time > 1:
+            stopwatch = '%ss' % round(response.time, 3)
+        else:
+            stopwatch = '%sms' % int(response.time * 1000)
         msg = 'OK! HTTP 200 after %s' % stopwatch
     else:
         msg = 'FAIL!'