mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
send all last_heartbeat data to enough_time_passed function
This commit is contained in:
parent
4bcddf2a98
commit
8faaa3b0e3
@ -136,10 +136,10 @@ def obfuscate_apikey(command_list):
|
|||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
def enough_time_passed(now, last_time, is_write):
|
def enough_time_passed(now, last_heartbeat, is_write):
|
||||||
if now - last_time > HEARTBEAT_FREQUENCY * 60:
|
if now - last_heartbeat['time'] > HEARTBEAT_FREQUENCY * 60:
|
||||||
return True
|
return True
|
||||||
if is_write and now - last_time > 2:
|
if is_write and now - last_heartbeat['time'] > 2:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ class SendHeartbeatThread(threading.Thread):
|
|||||||
with self.lock:
|
with self.lock:
|
||||||
if self.target_file:
|
if self.target_file:
|
||||||
self.timestamp = time.time()
|
self.timestamp = time.time()
|
||||||
if self.force or self.target_file != self.last_heartbeat['file'] or enough_time_passed(self.timestamp, self.last_heartbeat['time'], self.is_write):
|
if self.force or self.target_file != self.last_heartbeat['file'] or enough_time_passed(self.timestamp, self.last_heartbeat, self.is_write):
|
||||||
self.send_heartbeat()
|
self.send_heartbeat()
|
||||||
|
|
||||||
def send_heartbeat(self):
|
def send_heartbeat(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user