예제 #1
0
 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
예제 #2
0
 def test_heartbeat_expires__Decimal(self):
     assert heartbeat_expires(Decimal(344313.37),
                              freq=60,
                              expire_window=200) == 344433.37
예제 #3
0
 def test_heartbeat_expires__Decimal(self):
     assert heartbeat_expires(
         Decimal(344313.37), freq=60, expire_window=200) == 344433.37
예제 #4
0
 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
예제 #5
0
 def is_alive(self):
     if self.last_heartbeat:
         return time() < heartbeat_expires(self.heartbeat_timestamp)
     return False
예제 #6
0
 def test_heartbeat_expires__Decimal(self):
     self.assertEqual(
         heartbeat_expires(Decimal(344313.37), freq=60, expire_window=200),
         344433.37,
     )
예제 #7
0
 def is_alive(self):
     if self.last_heartbeat:
         return time() < heartbeat_expires(self.heartbeat_timestamp)
     return False
예제 #8
0
 def test_heartbeat_expires__Decimal(self):
     self.assertEqual(
         heartbeat_expires(Decimal(344313.37), freq=60, expire_window=200),
         344433.37,
     )