Skip to content

Commit

Permalink
Small bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gmemstr committed Mar 4, 2017
1 parent 23d33cf commit fe3bda5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,31 @@ def SetStatus(self,panel,online,cpu,memory,disk):
print("Set offline")
# Server just went offline
self.c.execute("UPDATE "+self.sqltable+" SET online=false, udtime=0 WHERE id="+str(panel))

self.db.commit()

if online == True and wasup == 1:
# Refresh stats (online)
print("Still online")
self.c.execute("UPDATE "+self.sqltable+" SET online=true, udtime="+
str(udtime + self.config.Get("scan_interval"))+", cpu="+
cpu + ", memory="+memory+",disk="+disk+" WHERE id="+str(panel))

self.db.commit()

if online == False and wasup == 0:
print("Still offine")
# Do nothing (offline)
self.c.execute("UPDATE "+self.sqltable+" SET online=false, udtime="+
str(udtime - self.config.Get("scan_interval"))+
" WHERE id="+str(panel))
self.db.commit()


if online == True and wasup == 0:
print("Set online")
# Panel just went onlie
self.c.execute("UPDATE "+self.sqltable+" SET online=true, udtime=0, cpu="+
cpu + ", memory="+memory+",disk="+disk+" WHERE id="+str(panel))
self.db.commit()
self.db.commit()

def RemoveServer(self, panel):
self.c.execute("DELETE FROM "+self.sqltable+" WHERE id="+str(panel))
Expand Down

0 comments on commit fe3bda5

Please sign in to comment.