Wed 29 Jun 2022

Retry XMLHttpRequest Carefully

It's rare to see a web app that doesn't use XMLHttpRequest (or fetch, the new API with comparable capability). XMLHttpRequest (which we can call XHR if you're into the whole brevity thing) is as handy as a shirt pocket, but it doesn't do much to encourage robust and resilient programming practices. Any app that runs in the real world will sometimes encounter transient network interruptions and server outages. We should gracefully recover from both by automatically retrying our requests. But, we shouldn't turn a brief server hiccup into a full-on fireworks display by retrying too fast or by having every client retry at the same time.

This good advice gives us three concrete goals:

  • Retry our XHR when we get an error.
  • Pause an appropriate duration before retrying.
  • Randomize the duration of the pause.

Source: Retry XMLHttpRequest Carefully, an article by Aaron D. Parks.

Things I wish everyone knew about Git (Part I)

When I first used Git it drove me almost to tears of rage and frustration. But I did get it under control. I don't love Git, but I use it every day, by choice, and I use it effectively.

The magic key that rescued me was John Wiegley's Git From the Bottom Up

Git From the Bottom Up explains the model. I read it. After that I wept no more. I understood what was going on. I knew how to try things out and how to interpret what I saw. Even when I got a surprise, I had a model to fit it into.

Source: Things I wish everyone knew about Git (Part I), an article by Mark Dominus.