mardi 19 juillet 2016

RoR: The right way of rescuing a DB exception on save?

I've recently faced the problem of my DB failing with Adaptive Server connection timed out quite often after I try to save an ActiveRecord model.

If I try to rescue this failed attempt I get ActiveRecord::StaleObjectError, so I have to recreate the object being saved from the very beginning which may be quite an expensive procedure.

What is the right way of handling this situation on the app side given that I cannot affect DB performance in any way?

Aucun commentaire:

Enregistrer un commentaire