Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: update cache synchronously #56

Open
steynh opened this issue Nov 20, 2024 · 0 comments
Open

Feature request: update cache synchronously #56

steynh opened this issue Nov 20, 2024 · 0 comments

Comments

@steynh
Copy link

steynh commented Nov 20, 2024

This is really awesome. Thank you for making this!

I found your repo while searching for something that can fulfill my use case, and bkt comes very close, but not quite. Seeing as you mentioned fzf in the readme, I figured this feature might be useful for you and others too, so creating a request here.

I have a command foo that takes about 1s to complete. So running foo | fzf does not give a very smooth experience.

bkt --ttl=1y --warm -- foo | fzf is much better, but if the output of foo changes, I need to run the command twice in order to see the new lines show up in fzf.

Ideally, what I would want, is for the cached content to show up in fzf immediately, and then have any changes drop in within a second or so. Usually, by the time I finish typing and having selected the entry, 1 second has already passed, so this would give a really smooth experience.

So the feature I'm hoping for is something like bkt --ttl=1y --sync-diff -- foo | fzf.

This would:

  1. write the cache to stdout (very fast, so at this point fzf would already be pre-populated with a cached result)
  2. synchronously run foo
  3. do a diff with the cache and write any "new" lines to stdout (this would take a second to complete, but when it does, fzf is not missing any data)
  4. update the cache with the latest output

I realize that if the cache contains any stale lines that do not show up in the stdout of the foo call from step 2, they would still show up in fzf, but this is not much of a problem to me. It's fine to have stale data, but missing new data is a problem.

Thank you for considering! I can also imagine if you'd not want to add this functionality, so feel free to close this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant