From bce656c7876bd33dd8db45966823ff2c5ab60066 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Tue, 5 Feb 2019 11:52:11 +0000 Subject: [PATCH] Retry updating revision - fixes #383 --- src/db/models/user.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/db/models/user.rs b/src/db/models/user.rs index 127fa78..390302a 100644 --- a/src/db/models/user.rs +++ b/src/db/models/user.rs @@ -184,10 +184,12 @@ impl User { pub fn update_revision(&mut self, conn: &DbConn) -> EmptyResult { self.updated_at = Utc::now().naive_utc(); - diesel::update(users::table.filter(users::uuid.eq(&self.uuid))) - .set(users::updated_at.eq(&self.updated_at)) - .execute(&**conn) - .map_res("Error updating user revision") + crate::util::retry( || { + diesel::update(users::table.filter(users::uuid.eq(&self.uuid))) + .set(users::updated_at.eq(&self.updated_at)) + .execute(&**conn) + }, 10) + .map_res("Error updating user revision") } pub fn find_by_mail(mail: &str, conn: &DbConn) -> Option {