I was driving to my daughter's school, listening to my iPod, set to shuffle my music, and "Code Monkey" came up. Imagine my surprise when I had a sudden epiphany on a longstanding bug in the blog server.
I had noticed that whenever I pushed a new post up, if I wanted the category specific feed to update, I needed to manually force that to happen. This was irritating, but I hadn't figured out why it was happening - the order (update the cache, then update the feed) looked right. What I hadn't done was delve into the process of cache updating. Here's what that looked like:
... self categoryCache add: category. [self cache cacheForCategorySearch: aBlog] forkAt: Processor userBackgroundPriority. ...
You might see the problem - the cache update code is forked, and at a lower priority than the active thread. Given the Smalltalk Process Model's operation, that thread is guaranteed to not run before the main thread does - which meant that the category specific feed was getting dropped before the cache got updated. I just made sure that the feed gets dropped within that fork, after the cache update - which solves the problem.
So what does it say about me that I came up with this during that song :)
Technorati Tags: smalltalk