mirror of
https://github.com/gamaio/gama_api.git
synced 2024-12-22 10:32:41 +00:00
Add rudimentary latency calculation to heartbeat
This commit is contained in:
parent
de37b7c056
commit
31e0ff9f24
@ -55,3 +55,7 @@ class api_heartbeat(models.Model):
|
|||||||
sent_time = datetime.datetime.strftime(self.time_sent, '%m/%d/%y %H:%M:%S')
|
sent_time = datetime.datetime.strftime(self.time_sent, '%m/%d/%y %H:%M:%S')
|
||||||
rcvd_time = datetime.datetime.strftime(self.time_rcvd, '%m/%d/%y %H:%M:%S')
|
rcvd_time = datetime.datetime.strftime(self.time_rcvd, '%m/%d/%y %H:%M:%S')
|
||||||
return '%s (%s:%s - %s ms)' % (self.api.name, sent_time, rcvd_time, self.latency)
|
return '%s (%s:%s - %s ms)' % (self.api.name, sent_time, rcvd_time, self.latency)
|
||||||
|
|
||||||
|
def determine_latency(self):
|
||||||
|
self.latency = (self.time_rcvd - self.time_sent).microseconds / 1000
|
||||||
|
return self
|
||||||
|
Loading…
Reference in New Issue
Block a user