It's all spinning wheels and self-doubt until the first pot of coffee.

Blo.gs Pings Gone Wild

Shawn Yeager just dropped me a line to let me know that my blog has apparently been pinging blo.gs like crazy today, and since he's set to recieve IM's on blog updates from blo.gs, he's been getting flooded with IMs.

First off, if this is happening to you: Sorry out there!

Second thing, this might be interesting for anyone using a blosxom plugin to ping blo.gs or weblogs.com like me. Basically, I took the ping_weblogs_com plugin for blosxom, replaced the weblogs.com request with one to blo.gs, and searched for the pattern 'congratulations' instead of 'Thanks for the ping' in the response. Finding the pattern is assumed to mean the ping was successful. A successful ping, then, causes the plugin to update the contents and timestamp of the status file with the response.

The status file is used by the plugin to determine whether or not a ping should be sent. This check is made everytime an item is viewed on my blog, and if the plugin sees a blog item whose timestamp is newer than that of the status file, a ping is sent.

So! Onto the punch-line: The appearance of the word 'congratulations' and the successful registration of a ping are not the same thing. Apparently, blo.gs has been throwing up an error message in response to a ping, while still registering a ping. This error message does not contain the word 'congratulations', and so my plugin never updates the status file, and so it happily tries pinging blo.gs again with the next blog view.

Two lessons learned here:

  1. When using a web service, whether a "real" service or a "scraped" service, be very sure to know and handle the difference between a valid response and an exception or error in the service itself.
  2. When using a web service, take care with your usage pattern. That is, just how important is success? Important enough to try again and again? Or could you wait awhile, whether successful or not? Or should you even try again?

My plugin doesn't know the real meaning of the response to a ping. And further, the fact that it's designed to try, try again in the case of apparent failure is not the greatest choice for a usage pattern.

So... longwinded post, but I think the realizations are valuable.


Archived Comments

  • What would be really nice is if the blo.gs response page made clever use of CSS like the W3C validator, by putting one (and, of course, only one) <div id="result" class="valid"> (or class="error") in the response, with the actual error message inside. Makes it really easy to write a bulk-validation script.