Deadlock retries

Retry transaction on deadlock error.
This is a part where I'm a little bit hazy on things. This block will potentially execute (I'm assuming) several SQL statements. Some of them might raise errors that are not deadlocks (which you account for in the `rescue` block). Are there multiple segments of code that might raise deadlock problems? Or is it just the `self.site.record_appearance` call inside the `last_appearance.nil?` conditional?

In other words - is this whole segment of code being rescued because the whole transaction needs to be started over again if any of it fails, or is it because anything inside of this block (including the `Appearance.transaction` call) might potentially raise a deadlock error?

If there are only segments of code that might raise the deadlock error, is there a possibility to wrap a smaller portion of the transaction block inside the `begin` and `rescue` clauses?