Retries an operation on an ActiveRecord until no StaleObjectError is being raised.