Friday, May 23, 2008

Something to do about Twitter's Downtime

So the smart thing for Twitter clients to start doing is caching updates and just auto-retrying every x minutes until the service finally comes back up.

There's a few different possible approaches:
  1. After failing to update the first time, fork. Parent exits, child sleeps 5 minutes, tries to post, and loops until successful. Runs the risk of lost updates if computer is shutdown before successful.
  2. Have a system daemon that reads from a spooler file. The user client only appends updates to the Twitter spool and alerts the daemon of a new update.
  3. After failing, simply caches the update and exits. Next time, on startup, check the cache file for updates, and attempt to post them. Does mean that if the client isn't used for a prolonged time, the update won't be posted until then.
Of the three approaches, the second comes off as the most robust. It just means having another daemon running on your system. If not only for approach three, for any of them have an expiration time for updates. Then, if an update still fails after, say, 8 hours, the client just gives up.

No comments:

Post a Comment