Aedif / TokenVariants

GNU General Public License v3.0
18 stars 12 forks source link

Cache File Does Not Populate #98

Closed ianelletson closed 1 year ago

ianelletson commented 1 year ago

Current version of module, Pathfinder 2e system, and Foundry.

Setting the Cache File under misc (one example shown below, but I've tried multiple) and then clicking "Cache Images" does not create a .json file, nor are any errors logged.

The folder exists; I have tried with and without a pre-existing .json file.

image

image

Aedif commented 1 year ago

The root of file paths is the FoundryVTT\Data folder, so the path should be: modules/token-variants/token-variants-cache.json

ianelletson commented 1 year ago

The root of file paths is the FoundryVTT\Data folder, so the path should be: modules/token-variants/token-variants-cache.json

I chose a poor example. I meant to have a "token-variants" folder in the FoundryVTT/Data/token-variants and put the cache there (so that it isn't removed on module update), see: image

Aedif commented 1 year ago

Hmm, strange, I replicated the setup and it works fine for me. Mind exporting the module settings and linking them here?

Grandsome commented 1 year ago

My caching also stopped working, I'm using WoD 20th 2.4 and the module version is 4.27. Maybe there's a new incompatibility. Here's my module list and the token variant settings: PackageList-latest.zip token-variants-settings.zip

Aedif commented 1 year ago

That's an awful lot of modules 😅. I tested on a fresh world using latest WoD and your TVA settings. The static cache was creating as it should be.

Could you try manually deleting the cache file in the module folder and then running the following in the console: game.modules.get("token-variants").api.TVA_CONFIG.debug = true Then manually cache the images: image

The console should now display output similar to this: image

Would you mind copy-pasting the output here? Might give me some insight into what's going on here...

Grandsome commented 1 year ago

"That's an awful lot of modules 😅" Yeah, I've got a problem. 😅 Here's what the console says after two one hour runs. I'm gonna run find the culprit sometime this week to see if I can find, uh, the culprit: image

image

Hardware info: I'm running the server on Ubuntu 22.04 LTS with a low power Haswell i7 on a Samsung SSD. Usually the cache would fill itself in seconds, less than a minute, maybe 2.

Aedif commented 1 year ago

Alright the fact that the caching doesn't finish means that the module is either getting stuck in an infinite loop or there is a request that for some reason doesn't time out and the module gets frozen.

My immediate thoughts go towards the s3 buckets. I don't have one setup so I can't test it myself right now but there might have been a change to how s3 file browsing works in Foundry...

If you run this:

let path = {
      "source": "s3:vzmtfoundryvtt-store1",
      "text": "newicons/",
      "types": [
        "Item",
        "JournalEntry",
        "Macro",
        "RollTable",
        "Tile"
      ],
      "cache": true
    };
let files = await FilePicker.browse('s3', path.text, {
    bucket: path.source.replace('s3:', ''),
});
console.log(files);

What does it return? Mainly interested in the dirs:

 { 
    dirs: [ . . . ]
}
Grandsome commented 1 year ago

I had my suspicions about the S3 bucket was that was my next test to see if it worked without them, anyway I ran the command it returns: image

Aedif commented 1 year ago

Could you click the arrow to the left of the 'target' to expand the object, I'd like to see if "newicons/" is among the dirs returned. That would be one of the possible ways the modules gets stuck in a loop. Sorry about this, I'd do all of this myself if I had an S3 bucket to test with.

But yes removing the buckets from the paths would be a nice way to quickly rule out that as a problem.

You can always re-import the module settings to restore the paths

Grandsome commented 1 year ago

I was able to cache with the latest update, well, maybe it's the update or what I did or both.

I started by unchecking cache for the S3 bucket paths and caching locally first, then I checked cache of my smallest S3 directory to the largest. It seems that icon directory is the problem, it's small in byte size, but the item count is maybe too large.

Or there's a weird permission problem with S3 or some limit on access calls.

I'll just rehost the svgs locally, I put them in remote because in my last game the svgs had a hard time loading for my players even on chrome.

I wonder if reducing the path length would help.

Anyway, I did a head count: 6 355 objects in the icon directory "newicons", maybe that's too much, current successful cache has 9 613 images (including the same icon directory but local).

Aedif commented 1 year ago

The update did include some minor bug fixes which may have had an impact.

I'll leave the issue open for now but will close it in the near future if no further problems are reported.