[FEATURE] General cache location for stadium image in Area Sizer #2440#2457
[FEATURE] General cache location for stadium image in Area Sizer #2440#2457sgcr wants to merge 2 commits into
Conversation
b5917cc to
c696ee5
Compare
c696ee5 to
a39b4d5
Compare
|
` [Debug] CachedUrlImageProvider: Image could not be loaded from URL 'https://res.hattrick.org/arenas/13/124/1239/1238716/custom-220-100.jpg': https://res.hattrick.org/arenas/13/124/1239/1238716/custom-220-100.jpg [Debug] CachedUrlImageProvider: Saved image (format 'PNG') to file 'C:\Users\wolfg\Documents\HO\img\stadiumImages\2f0598f59db03c179b1fa13a88b94ca4bc08ceb2119f20e0914ebf532a3d3d33.png'. 2nd start of arena sizer gives this logs: ` [Debug] CachedUrlImageProvider: Image could not be loaded from URL 'https://res.hattrick.org/arenas/13/124/1239/1238716/custom-220-100.jpg': https://res.hattrick.org/arenas/13/124/1239/1238716/custom-220-100.jpg [Debug] CachedUrlImageProvider: Image loaded from file 'C:\Users\wolfg\Documents\HO\img\stadiumImages\2f0598f59db03c179b1fa13a88b94ca4bc08ceb2119f20e0914ebf532a3d3d33.png'. These logs confuse me a bit: Why is it being reported that a load isn't working, even though an image is being saved? Why is the download being done again on the second try, even though there's an image in the cache? |
Well, there is a primary image URL and a fallback image URL: The fallback image URL can be loaded and can be saved to a file and is therefore cached the next time. When the dialog is opened the second time, the primary image URL is looked up in the cache first and cannot be found. Afterwards the fallback URL should be read from the file cache. Proposal: But in that case the URL is still read and 404 is returned until you design your custom stadium image. |
I think, most of the HO users don't have custom stadium images. I would prefer if the cached image file is available, it should be used. The players' avatars are presented as buttons, which can be used to download the avatars on user request. What do you think about the same solution for the stadium images? |
I agree that if a cached image is available, it should be used. If we want to avoid these repeated 404 requests, I think the clean solution would be to cache the missing primary image state as well. However, I would not cache this state forever. So I would suggest combining both ideas:
This avoids repeated 404 requests, avoids permanently stale cache entries, and should still keep the traffic very low because the image is only requested when the Arena Sizer is opened. |
src/main/resources/release_notes.md...