wakatime / micro-wakatime

Micro editor plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/micro
22 stars 4 forks source link

checking for cli updates slows down micro startup #5

Open RaphyJake opened 3 years ago

RaphyJake commented 3 years ago

the checkCli() call in the init() function takes about two seconds on my machine:

2021/03/18 12:46:31 Micro started
2021/03/18 12:46:31 initializing WakaTime v1.0.3
2021/03/18 12:46:31 Current wakatime-cli version is 13.0.7

2021/03/18 12:46:31 Checking for updates to wakatime-cli...
2021/03/18 12:46:33 wakatime-cli is up to date
2021/03/18 12:46:33 WakaTime initialized

This is reasonable, my internet connection is not one of the best. Still, since in these two seconds I can't use micro (and I tend to open / close micro a lot) I was wondering if there was some way to make micro instantly usable, for instance by doing the update-checking part concurrently (at the risk of losing a few keystrokes if you start typing with an outdated wakatime cli)

micro version:

Version: 2.0.9-dev.52
Commit hash: 6f949fe9
Compiled on March 18, 2021
gandarez commented 3 years ago

Unfortunately there's no fnacy way to start threads in Lua (which is the plugins' language). By this reason at this time we need to wait for checkCli() to finish execution before actually opening the terminal. Also in micro everything seems to be run synchronous.

Xevion commented 1 year ago

Unfortunately there's no fnacy way to start threads in Lua (which is the plugins' language). By this reason at this time we need to wait for checkCli() to finish execution before actually opening the terminal. Also in micro everything seems to be run synchronous.

Regardless of whether this is fixable right now, this is still a pretty ridiculous downside to the plugin and needs to either be addressed or be given proper notice on the README. I decidedly won't be using this plugin due to the insane delay.

Here's a solution: Remembering the last time a check was made, and then not making a request for a week or at least a day later. Or caching the S3 bucket response, however you'd like to go about it.

In my opinion, update checking should be made part of the CLI itself, and not offloaded to the plugin to check.

A 2 second delay for using Micro is UNACCEPTABLE. This issue is not resolved.