Skip to content

Commit

Permalink
Merge pull request #61 from littleskunk/patch-3
Browse files Browse the repository at this point in the history
removed server workload influence for ping
  • Loading branch information
F483 committed Sep 14, 2015
2 parents fdbd113 + 4a69328 commit ac3d192
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dataserv/Farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ def ping(self):
we just want to know if they are still there.
"""
pingtime = datetime.utcnow()
farmer = self.lookup()
delta = datetime.utcnow() - farmer.last_seen
delta = pingtime - farmer.last_seen
time_limit = delta.seconds >= app.config["MAX_PING"]

if time_limit:
farmer.last_seen = datetime.utcnow()
farmer.last_seen = pingtime
db.session.commit()
# else just ignore

Expand Down

0 comments on commit ac3d192

Please sign in to comment.