LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
12.95k stars 859 forks source link

Always save remote image data #4875

Open sunaurus opened 1 week ago

sunaurus commented 1 week ago

4704 made saving data into the remote_image table conditional on a successful image proxying request.

In practice, I have found that the first image proxy requests quite often don't finish before the default request timeout (happens as often as every 2 out of 10 images on lemm.ee). Even after increasing the default timeout to 60 seconds, I still see occasional broken images.

Currently in the main branch, a failed initial proxy attempt means that the image will be broken forever, because subsequent requests will never succeed if the image URL is missing from the remote_image table. This PR proposes always saving data into remote_image before even trying to proxy it for the first time, that way, even if the first proxy attempt fails, subsequent ones can still succeed.