!Friendica Developers
Hi, I have been looking into link previews and especially why a PeerTube video preview image (when the video is linked to in a Friendica post) doesn't update on Friendica after it has been updated on PeerTube. The main reason I found was that PeerTube doesn't set any cache-control headers or expire headers on its dynamic content, just the 'etag'. I think I can deal with that within PeerTube's nginx.
But I also found that Friendica stores the parsed site info from the url in the database, for a full 3 months (in such cases), without allowing it to be evicted earlier from that cache. In fact the logic seems to be:
- If parsing the site info fails, store that failure for 1 day before trying again
- If no max-age is present on the cache control header returned by the site, store the parsed info for 3 months. This value is not configurable. (Also applies if the cache control header says something like 'no-cache')
- If a max-age is present, use that, with a minimum of 1 day. This minimum value is also not configurable.
- The maximum storage time in our database is therefore infinite, if a site requests this.
- Removal from the database table is only done by a worker based on that set storage time.
Is this logic intentional and desired? If so, I'll just change the hardcoded values on my own site (to something much lower). If not, a configurable min and max cache time may be useful? Maybe use the 'etag' somehow? Maybe always refresh the site-info if a user puts the link in the post form?
Friendica Developers reshared this.
Gidi Kroon
in reply to Gidi Kroon • •I've been running with these hardcoded changes for a few days on a single user instance and it works fine. The highest expire date in the
parsed_url
table was in the year 4044; I decided not to wait for that and emptied the whole table a few days ago.code of screenshot
I've been running with these hardcoded changes for a few days on a single user instance and it works fine. The highest expire date in the
parsed_url
table was in the year 4044; I decided not to wait for that and emptied the whole table a few days ago.code of screenshot
For a single user instance it is rare to see the same post more than an hour later. But also when looking at older posts I don't notice any problems. For me there is no reason to keep the data of other sites for 3 months (without even checking for changes) and even when set to 1 hour, it is still less load on the other sites then when I would be browsing them directly as one user. I think that at least for single user instances, these can be considered as defaults as well.
Friendica Developers reshared this.