better comments around heartbeat logic
This commit is contained in:
parent
8d3988ce97
commit
f1b6c2a142
1 changed files with 13 additions and 2 deletions
|
@ -383,6 +383,10 @@ let s:VERSION = '4.0.15'
|
||||||
if !empty(file) && file !~ "-MiniBufExplorer-" && file !~ "--NO NAME--" && file !~ "^term:"
|
if !empty(file) && file !~ "-MiniBufExplorer-" && file !~ "--NO NAME--" && file !~ "^term:"
|
||||||
let last = s:GetLastHeartbeat()
|
let last = s:GetLastHeartbeat()
|
||||||
let now = localtime()
|
let now = localtime()
|
||||||
|
|
||||||
|
" Create a heartbeat when saving a file, when the current file
|
||||||
|
" changes, and when still editing the same file but enough time
|
||||||
|
" has passed since the last heartbeat.
|
||||||
if a:is_write || s:EnoughTimePassed(now, last) || file != last[2]
|
if a:is_write || s:EnoughTimePassed(now, last) || file != last[2]
|
||||||
call s:AppendHeartbeat(file, now, a:is_write, last)
|
call s:AppendHeartbeat(file, now, a:is_write, last)
|
||||||
else
|
else
|
||||||
|
@ -390,8 +394,15 @@ let s:VERSION = '4.0.15'
|
||||||
call s:SetLastHeartbeatInMemory(now, last[1], last[2])
|
call s:SetLastHeartbeatInMemory(now, last[1], last[2])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if now - s:last_sent > 10
|
|
||||||
call s:SendHeartbeats()
|
" Windows non-debug mode disables buffering heartbeats, so
|
||||||
|
" no need to re-send.
|
||||||
|
if !s:IsWindows() || s:is_debug_mode_on
|
||||||
|
|
||||||
|
" Only send buffered heartbeats every 10 seconds
|
||||||
|
if now - s:last_sent > 10
|
||||||
|
call s:SendHeartbeats()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Reference in a new issue