Repository navigation
Check the online project templates once per session - #1766
Open
simonvanlierde wants to merge 1 commit into
Open
simonvanlierde wants to merge 1 commit into
simonvanlierde wants to merge 1 commit into
Conversation
- Cache the remote template catalogue for the session, including a failed fetch, so a project switch no longer waits on files.brightway.dev. - Add "Refresh remote templates" to the Templates tab in Settings > Projects. - Rebuild the "Import from template" menu when it opens, so it shows a refreshed catalogue and newly created local templates.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Bernhard,
As you suggested in #1745, AB now fetches the template catalogue from files.brightway.dev once per session instead of on every project switch. On a slow connection, every switch waited for that request on the main thread.
fetch_remote_projects()is now cached for the session withlru_cache.ProjectManagerSettingsChapter.synccalled it every time, which means every project switch and every Save, Cancel and Restore Defaults in Settings. A failed fetch is cached too, so the list stays empty until you refresh.ProjectNewTemplateMenu(Project > New > Import from template) now rebuilds when it opens, so it picks up a refresh. Templates made with "Create template from project" now also show up there without a restart.With bw2io's request faked to take 2 s, a project switch took 4.2 s on
majorand 0.23 s with this change. The test setup keeps two Settings pages alive, so it makes two requests per switch; the app makes one, so expect about half that saving there. I haven't measured it in the real app.Tests: 2 new tests in
tests/test_remote_templates.py(no network, bw2io is faked). Full suite on Python 3.12, Linux, offscreen: 470 passed, 2 skipped, 1 failed. The failure istest_database_delete_multiple("QAbstractEventDispatcher already deleted" inDatabaseOpen.run), and it fails the same way onmajorin my setup, so it's not from this change. I couldn't try Windows or macOS.Checklist
./activity_browser/docs/wikiIf you have write access (otherwise a maintainer will do this for you):
bug,feature,ui,change,documentation,breaking,cias they show up in the changelog. (no write access)
Refs #1745
Best,
Simon