stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
98 stars 25 forks source link

[ ux ] Pack's caching happens in undesired moments #235

Open buzden opened 1 year ago

buzden commented 1 year ago

I don't know if this has a good solution, but anyway this is a user experience report.

Since recent changes pack caches almost on every operation and usually it prints nice log messages about this. This is great.

But what I encountered recently is when my internet connection is poor (say, for some reason, nameserver response tooks a minute or two), I can't use my shell ;-) The reason is that I have both idris2 and pack bash completion, and I found out that caching happens when bash completion scripts are returning too. And since pack waits as much as it can for the caching process, bash completion script is returned either after git timeouted, is laggy nameserver finally gives a response. That's annoying :-(

Also, the similar problem seems to happen when I start my vim with lsp in custom environments: looks like lsp being run using the current pack configuration, waits for pack to cache before it can start. However, I'm not really sure about the order of run in this case.

stefan-hoeck commented 1 year ago

That's strange. On my machine, pack caches only when I run pack switch or pack fetch. Do you have custom pack.toml files with commit = "main:fetch-latest" meta commits? These connect to GitHub (and perform caching) every time pack is run.

I run pack a lot when I don't have an internet connection at all, and this hasn't been an issue so far.

buzden commented 1 year ago

Do you have custom pack.toml files with commit = "main:fetch-latest" meta commits?

No, I don't

I run pack a lot when I don't have an internet connection at all, and this hasn't been an issue so far.

When there is no internet connection at all there is no problem. The problem when internet connection is laggy.


Consider the following case. Say, I used some collection and new collection came out with a change in the compiler commit and some other libraries update. Consider that I run pack switch latest on a project with a custom compiler commit in the local pack.toml and it succeeds. And now I logout and login (and bash completion is tried to be applied).

I think this may be the case when I ran into this problem.

stefan-hoeck commented 1 year ago

OK, now this makes sense. Although you ran pack switch, only the custom commits of the Idris compiler and libraries used locally will be fetched, but not the commits used in the vanilla pack collection. In that case, yes, the missing .ipkg files still need caching. I don't see an easy way around this other than making sure you run pack info outside of your project once after running pack switch inside your project, in which case the vanilla .ipkg files will be cached too.