empatheticbot / the-traveler-times

A Destiny 2 news website built using the Eleventy, Cloudflare Pages, Workers, and Durable Objects.
https://thetraveler.news
ISC License
11 stars 1 forks source link

Add Stale Data Indicator If Rebuild Fails a Couple Times #5

Closed sledsworth closed 2 years ago

sledsworth commented 3 years ago

If Bungie's API is down or we experience some other error that causes the scheduled front-end build to fail we don't currently indicate to the user that the data they are viewing could be out of date. I'd like to keep as much of the site static as possible for cost savings and performance, but it might be beneficial to look into Eleventy Serverless for server-side rendering of current data. Alternatively, Cloudflare HTMLRewriter could also be used to update the rendered page. Of course, this could be overthinking it and we could just include minimal JS to change style of last updated section if the date is older than an hour.

sledsworth commented 2 years ago

Two changes were made that should take care of this:

  1. The live data service with the warning banner allows me to update the site without a rebuild, so I can get around the issue where the build fails from Bungie API being down.
  2. Added some JS to display an error message next to the last update time if it's been over two hours since the last refresh, warning users the data is stale.