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

CLI: app create - Template handling improvements #4805

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

theduke
Copy link
Contributor

@theduke theduke commented Jun 4, 2024

Adds a local template cache (currently 15 minutes), and fetches more templates
from the backend, currently up to 100.

Also sorts the templates by popularity now.

NOTE: we should really use dialoger::FuzzySelect to give users a search prompt,
but that currently conflicts with the custom stylings of the select items and
messes up the formatting.
(See console-rs/dialoguer#312)

Closes #4804

@theduke theduke requested a review from syrusakbary as a code owner June 4, 2024 20:55
@theduke theduke requested review from xdoardo and removed request for syrusakbary June 4, 2024 20:56
@theduke
Copy link
Contributor Author

theduke commented Jun 5, 2024

Note: we should add a different step in here that improves timings:

  • always fetch the first page of templates
  • compare the results with the first page in the cache
  • if equivalent, we can use the cache, otherwise we refetch

That'll improve performance, because right now the cache time is just set to 15 minutes.

theduke added 2 commits June 11, 2024 12:06
* Add fetch_all_app_templates() helper
* Allow sorting of templates
* Make AppTemplate serializable

NOTE: requires a version bump due to a breaking api change
* Store templates in a local cache to speed up queries
  Currently caches for 15 mins
* Load more templates
@theduke theduke force-pushed the issue-4804-app-create-templates branch from b8e3685 to b8fec8a Compare June 11, 2024 10:54
@theduke
Copy link
Contributor Author

theduke commented Jun 11, 2024

Note, I improved the caching logic by :

* Always use the cache for a given period (1h)
* If cache is older than that, just fetch the first page, and compare
  if no changes, then can re-use the cache
* Otherwise, refetch all

@theduke theduke force-pushed the issue-4804-app-create-templates branch from b8fec8a to 23224ba Compare June 11, 2024 11:01
* Always use the cache for a given period (1h)
* If cache is older than that, just fetch the first page, and compare
  if no changes, then can re-use the cache
* Otherwise, refetch all
@theduke theduke force-pushed the issue-4804-app-create-templates branch from 23224ba to 6d7d761 Compare June 11, 2024 11:03
@syrusakbary syrusakbary merged commit 10a55f5 into main Jun 11, 2024
62 checks passed
@syrusakbary syrusakbary deleted the issue-4804-app-create-templates branch June 11, 2024 13:30
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

Successfully merging this pull request may close these issues.

CLI: wasmer app create only shows a small subset of templates
3 participants