Larkinabout / fvtt-token-action-hud-core

Token Action HUD is a repositionable HUD of actions for a selected token.
13 stars 19 forks source link

[BUG] flags bloat user.db file size and cause issues with The Forge #106

Closed finalfrog closed 1 year ago

finalfrog commented 1 year ago

Describe the bug I ran into an issue today where The Forge got confused by my user.db being excessively large causing it to treat it as corrupted.

Steps to reproduce

  1. Activate module with 6-7 players in campaign

Expected: user.db is only a couple of KB

Observed: user.db is 3.3 MB: users.zip

Versions:

Notes: I had to basically reset The Forge user configuration for the campaign today because it thought my user.db was corrupt. I showed my user.db to KaKaRoTo and he said that user.db shouldn't be larger than a couple KB and was confused why a module would put MBs worth of data into it. I'm going to have to disable this module to avoid having this issue again, so I figured I should post a bug report.

I realize whether this is a bug on Forge or on this module is probably a matter of perspective. If you want to debate it and see if The Forge can make changes to accommodate flags in the user.db talk to KaKaRoTo.

Larkinabout commented 1 year ago

There's probably quite a bit that could be done to minimise flag data stored against the users, however it would be useful to know what is the current upper limit for The Forge. With the availability of flags in the user object, any module could increase the size of the users.db file, it just so happens that Token Action HUD Core uses it readily.

There's already some changes in the next release to move some data to the actor flag and to not store actions data against the user. That will clear out quite a bit of data. I'll also look to stop storing the defaults against the user and just load them in from the module files.

Larkinabout commented 1 year ago

Spoke with The Forge team. The next release of Token Action HUD Core will reduce the data held within the user flags and The Forge team will also look at increasing allowable size of the users.db.

MrPrimate commented 1 year ago

I have noticed that scenes with a lot of actors can bloat, doubling the size of exports, sometimes from say 5 to 10mb if there are a lot of walls, lights, actors etc.

Larkinabout commented 1 year ago

Somewhat to be expected with the HUD saving to actor flags. Truncation of the database to remove logs seems to happen when you close and reopen a world. The next release reduces the number of times the actor flag data is updated to reduce db growth during play. The data that is stored, especially with the next release, is as small as it can be for actors, due to the HUD needing to know the layout and what actions are selected.

Larkinabout commented 1 year ago

Sorry, just noted that this is increasing the scenes. I guess that means Foundry loads all of the actor data into the scene multiple times for every token, which would make the scene quite large with the HUD flag data. Not sure what I can do about that apart from keep trying to find ways to reduce the size. It'll probably mean reducing the size of strings where possible as I'm not sure there's any more that can be stripped out.

Has this caused any issues or is it just something you've noticed with the file sizes?

Larkinabout commented 1 year ago

Self note to try always reloading actions on HUD update and not save the action state to flags except for id and whether it's selected by the user.

MrPrimate commented 1 year ago

I've not noticed any personal impact, but suspect it will start to impact world load time. I noticed it in some user submitted scene configs for DDB

Larkinabout commented 1 year ago

Actor and user flag data has moved to json files in Token Action HUD Core 1.4.0.