remy / unrot.link

Un-rot your links using the archive.org
26 stars 3 forks source link

redirect hangs if wayback API is unavailable #8

Open willnorris opened 8 months ago

willnorris commented 8 months ago

Some time this week during my testing, I noticed that unrot redirects for dead links were hanging. I tried going to archive.org directly, and the whole site was temporarily down. It looks like the calls to the CDX API (here and here) are just using plain fetch rather than fetchWithTimeout. Was this intentional?

In this case, we already know the link itself isn't live, so timing out and redirecting to the original URL still isn't going to get a successful page. But I think redirecting to the original link, even if it's known to be dead, may be better than hanging at the unrot URL indefinitely? maybe?

remy commented 8 months ago

I didn't use the fetchWithTimeout on the assumption that the CDX wouldn't actually hang! But yeah, archive being down wasn't factored at all… 🤔

I'll get this changed to that it uses the timeout (and if it does timeout, it doesn't bother with any further archive calls).

I've also been thinking about your other #7 issue (but I'll comment there for others) - I've just been a bit more offline during christmas holidays with family.