Skip to content

Conversation

@Haoming02
Copy link
Contributor

Description

  • simple description: Use the diskcache package to store the Webui's config_states, which also evicts the old sates automatically. No more tens of if not hundreds of .json files laying around~
  • summary of changes:
    • Create a new diskcache.Cache at the same directory
      • Defaults to keeping 1 MB of configs
    • Move the actual saving part into config_states.py
    • Add a new function to automatically convert existing .json files into the database
    • Change the storage key to just {timestamp}_{name}

Checklist:

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 8, 2025

I'm not sure on this
I feel config_states is useful for if you wish to transfer extensions between instances
so it has to be a single file that the user can transfer

@Haoming02
Copy link
Contributor Author

Hmm... that's a good point.

Maybe an export to .json button? or nah?

@w-e-w
Copy link
Collaborator

w-e-w commented Feb 8, 2025

I don't really see too much benefit of using diskcache
I feel like if user is that bothered by the old config files then they could delete them
this part of code is really not that intensive it's simply scans the file names and reads on demand
and also does not get read and write often

I see only issues
if for some reason webui is broken by an extention update, it is possible that the use config status, to find out what it has changed and then fix it
if is is sotred in json file everyone can read with a text editor, without webui
but we switch to diskcache basically means that it's only viewable from within webui, when webui is working

while some of the issues can be solved by adding a export button but it also means that the user has to deliberately export the file

@Haoming02 Haoming02 closed this Feb 8, 2025
@Haoming02 Haoming02 deleted the configstates-diskcache branch February 10, 2025 05:55
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.

2 participants