All timestamps should be in UTC. Without this patch, the scheduler unit tests fail for anyone sufficiently East of Greenwich.

This commit is contained in:
Soren Hansen
2010-09-23 04:24:54 -05:00
parent ce0a9b7b36
commit 08622cb48c

View File

@@ -42,7 +42,8 @@ class Scheduler(object):
def service_is_up(service):
"""Check whether a service is up based on last heartbeat."""
last_heartbeat = service['updated_at'] or service['created_at']
elapsed = datetime.datetime.now() - last_heartbeat
# Timestamps in DB are UTC.
elapsed = datetime.datetime.utcnow() - last_heartbeat
return elapsed < datetime.timedelta(seconds=FLAGS.service_down_time)
def hosts_up(self, context, topic):