def is_alive(self): """Return whether the worker is currently alive or not.""" if self.last_heartbeat: # Use UTC timestamp if USE_TZ is true, or else use local timestamp timestamp = mktime(gmtime()) if settings.USE_TZ else time() return timestamp < heartbeat_expires(self.heartbeat_timestamp) return False
def test_heartbeat_expires__Decimal(self): assert heartbeat_expires(Decimal(344313.37), freq=60, expire_window=200) == 344433.37
def test_heartbeat_expires__Decimal(self): assert heartbeat_expires( Decimal(344313.37), freq=60, expire_window=200) == 344433.37
def is_alive(self): if self.last_heartbeat: # Use UTC timestamp if USE_TZ is true, or else use local timestamp timestamp = mktime(gmtime()) if settings.USE_TZ else time() return timestamp < heartbeat_expires(self.heartbeat_timestamp) return False
def is_alive(self): if self.last_heartbeat: return time() < heartbeat_expires(self.heartbeat_timestamp) return False
def test_heartbeat_expires__Decimal(self): self.assertEqual( heartbeat_expires(Decimal(344313.37), freq=60, expire_window=200), 344433.37, )