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

View File

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