Deadlock retries

Retry transaction on deadlock error.
With the refactoring in e35aa8f30cf4c7796425993fc977d9f8e0a3f066 to remove `prompt` from the return tuple, you can skip this `else` condition entirely. You don't need `prompt = appearance.prompt` anymore, and you could eliminate `last_appearance` entirely and just assign `appearance` (I think). Something like:


```ruby
Appearance.transaction do
  appearance = get_first_unanswered_appearance(visitor, offset)
  if appearance.nil?
    # Only choose prompt if we don't already have one. If we had to
    # retry this transaction due to a deadlock, a prompt may have been
    # selected previously.
    prompt = choose_prompt(:algorithm => params[:algorithm]) unless prompt
    appearance = self.site.record_appearance(visitor, prompt)
  end
end
```

That still gets the same result, right? Maybe re-using the `appearance` variable in that manner obfuscates what's actually going on, though.