I want to apologize for the spotty gravatar syncing that has been occurring over the last two weeks. I’ve finally identified and fixed the bug that was causing the problem and your gravatar selections should propagate correctly now. I will go back and re-sync everyone just to make sure all the failed syncs get done.
The way Gravatar 2.0 deals with serving gravatar images is a multi-step process. When you assign a gravatar to an email address, the system takes your image, creates 80 scaled images from that (from 1×1 to 80×80) and puts them into a directory structure that will allow the gravatar serving lighttpd servers to serve them directly as files. Once the directory structure is created, it is tarred and gzipped to create a single compressed file that represents the images for a specific email address (based on the sha1 of the address). This file is then uploaded to Amazon S3 for distribution to the gravatar serving servers (of which there are 2). In addition, a message is placed on a queue for each server (via Amazon SQS). This completes step 1. On each gravatar serving server there is a process that pops messages off its queue, downloads the stated file from S3, and extracts it into the correct location. It is then available for serving to the internet. This completes step 2.
The problem was that the library I am using to interface with S3 (AWS/S3 in Ruby) had a bit of a quirk that seemed like it should have worked, but didn’t. For the benefit of others, I present the problem code and the solution.
The original, offending code:
AWS::S3::Base.establish_connection!(
:access_key_id => '***********************',
:secret_access_key => '**************************************'
)
bucket = AWS::S3::Bucket.find('gravatar')
archive = bucket[sha1 + ".tar.gz"]
This code connects to the S3 service, gets the ‘gravatar’ bucket, then grabs the file from it. Simple enough, but misleading. When you get the bucket, only the first 1000 items within it are returned (a byproduct of the Amazon S3 API). Then, when you try to grab your file from the bucket, the file will be returned only if the item was within those 1000 items. This explains why Gravatar worked fine at first, then degraded to where fewer and fewer successful syncs where happening. It’s a devious bug to detect, and the documentation was not forthcoming on why this might be happening.
If you know that the object you’re interested in is in S3 but it can’t be found during a lookup, you’ll want to fetch the item directly, thereby eliminating the problem of a maximum of 1000 returned items. In retrospect, this is obviously the more desirable way to do things.
Here is the fixed code:
AWS::S3::Base.establish_connection!(
:access_key_id => '***********************',
:secret_access_key => '**************************************'
)
archive = AWS::S3::S3Object.find(sha1 + ".tar.gz", 'gravatar')
So, if your gravatar has not been appearing properly, you can reassign it to your email address and it will propogate now. As I said before, I will push the entire contents of S3 onto the queues to make sure everyone is up to date.
I’m very sorry this problem took so long to fix, and I understand your frustration. I hope you will once again be happily gravataring!
Tom