check wakatime-cli versions in background thread to prevent blocking UI

This commit is contained in:
Alan Hamlett 2022-06-25 13:45:29 -03:00
parent 28063e3ac4
commit c1f58fd05d
1 changed files with 5 additions and 4 deletions

View File

@ -594,9 +594,7 @@ def plugin_loaded():
log(INFO, 'Initializing WakaTime plugin v%s' % __version__)
update_status_bar('Initializing...')
if not isCliLatest():
thread = DownloadCLI()
thread.start()
UpdateCLI().start()
after_loaded()
@ -632,11 +630,14 @@ class WakatimeDashboardCommand(sublime_plugin.ApplicationCommand):
webbrowser.open_new_tab('https://wakatime.com/dashboard')
class DownloadCLI(threading.Thread):
class UpdateCLI(threading.Thread):
"""Non-blocking thread for downloading latest wakatime-cli from GitHub.
"""
def run(self):
if isCliLatest():
return
log(INFO, 'Downloading wakatime-cli...')
if os.path.isdir(os.path.join(RESOURCES_FOLDER, 'wakatime-cli')):