mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
decreased number of events handled using global lock variable and skipping events without a file associated to the view
This commit is contained in:
parent
9d21626459
commit
d3d4a65538
@ -108,36 +108,41 @@ def should_prompt_user(now):
|
|||||||
|
|
||||||
|
|
||||||
def handle_write_action(view):
|
def handle_write_action(view):
|
||||||
now = time.time()
|
global BUSY
|
||||||
|
BUSY = True
|
||||||
targetFile = view.file_name()
|
targetFile = view.file_name()
|
||||||
if enough_time_passed(now) or targetFile != LAST_FILE:
|
if targetFile:
|
||||||
if should_prompt_user(now):
|
now = time.time()
|
||||||
if away(now):
|
if enough_time_passed(now) or targetFile != LAST_FILE:
|
||||||
api(targetFile, now, endtime=LAST_ACTION, isWrite=True)
|
if should_prompt_user(now):
|
||||||
|
if away(now):
|
||||||
|
api(targetFile, now, endtime=LAST_ACTION, isWrite=True)
|
||||||
|
else:
|
||||||
|
api(targetFile, now, isWrite=True)
|
||||||
else:
|
else:
|
||||||
api(targetFile, now, isWrite=True)
|
api(targetFile, now, endtime=LAST_ACTION, isWrite=True)
|
||||||
else:
|
else:
|
||||||
api(targetFile, now, endtime=LAST_ACTION, isWrite=True)
|
api(targetFile, now, isWrite=True)
|
||||||
else:
|
BUSY = False
|
||||||
api(targetFile, now, isWrite=True)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_normal_action(view):
|
def handle_normal_action(view):
|
||||||
global LAST_USAGE, BUSY
|
global LAST_USAGE, BUSY
|
||||||
now = time.time()
|
BUSY = True
|
||||||
targetFile = view.file_name()
|
targetFile = view.file_name()
|
||||||
if enough_time_passed(now) or targetFile != LAST_FILE:
|
if targetFile:
|
||||||
BUSY = True
|
now = time.time()
|
||||||
if should_prompt_user(now):
|
if enough_time_passed(now) or targetFile != LAST_FILE:
|
||||||
if away(now):
|
if should_prompt_user(now):
|
||||||
api(targetFile, now, endtime=LAST_ACTION)
|
if away(now):
|
||||||
|
api(targetFile, now, endtime=LAST_ACTION)
|
||||||
|
else:
|
||||||
|
api(targetFile, now)
|
||||||
else:
|
else:
|
||||||
api(targetFile, now)
|
api(targetFile, now, endtime=LAST_ACTION)
|
||||||
else:
|
else:
|
||||||
api(targetFile, now, endtime=LAST_ACTION)
|
LAST_USAGE = now
|
||||||
BUSY = False
|
BUSY = False
|
||||||
else:
|
|
||||||
LAST_USAGE = now
|
|
||||||
|
|
||||||
|
|
||||||
class WakatimeListener(sublime_plugin.EventListener):
|
class WakatimeListener(sublime_plugin.EventListener):
|
||||||
|
Loading…
Reference in New Issue
Block a user