From f6fda516a02afc3b387d7d0125b6c36dfbe57101 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sat, 17 Apr 2010 15:13:59 +0200 Subject: [PATCH] Cambiato IsAlive() con IsLastAlive() nelle statistiche per non rallentare tutto. --- phcstats.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phcstats.py b/phcstats.py index 9a580ca..40c1993 100755 --- a/phcstats.py +++ b/phcstats.py @@ -37,6 +37,14 @@ def IsAlive(client): stderr = subprocess.PIPE) return (alive == 0) +def IsLastAlive(client): + """ + Ritorna True se il client era acceso durante l'ultimo check + effettuato. + """ + data = LoadClientData(client) + return data.items()[-1:][0][1] + def LoadClientData(client): """ Carica i dati relativi a quel determinato client. Questi @@ -95,7 +103,7 @@ def PrintStats(client): ss = ss / (d[-1:][0][0] - d[0][0]) uptime = 100.0 * ss - if IsAlive(client): + if IsLastAlive(client): is_online = "yes" else: is_online = "no" -- 2.1.4