mirror of
https://github.com/ViViDboarder/bitwarden_rs.git
synced 2024-11-22 21:26:38 +00:00
Merge pull request #385 from mprasil/update_revision_retry
Retry updating revision - fixes #383
This commit is contained in:
commit
b75f38033b
@ -842,7 +842,7 @@ fn move_cipher_selected(data: JsonUpcase<MoveCipherData>, headers: Headers, conn
|
|||||||
}
|
}
|
||||||
|
|
||||||
for uuid in data.Ids {
|
for uuid in data.Ids {
|
||||||
let mut cipher = match Cipher::find_by_uuid(&uuid, &conn) {
|
let cipher = match Cipher::find_by_uuid(&uuid, &conn) {
|
||||||
Some(cipher) => cipher,
|
Some(cipher) => cipher,
|
||||||
None => err!("Cipher doesn't exist"),
|
None => err!("Cipher doesn't exist"),
|
||||||
};
|
};
|
||||||
@ -853,12 +853,11 @@ fn move_cipher_selected(data: JsonUpcase<MoveCipherData>, headers: Headers, conn
|
|||||||
|
|
||||||
// Move cipher
|
// Move cipher
|
||||||
cipher.move_to_folder(data.FolderId.clone(), &user_uuid, &conn)?;
|
cipher.move_to_folder(data.FolderId.clone(), &user_uuid, &conn)?;
|
||||||
cipher.save(&conn)?;
|
|
||||||
|
|
||||||
nt.send_cipher_update(
|
nt.send_cipher_update(
|
||||||
UpdateType::CipherUpdate,
|
UpdateType::CipherUpdate,
|
||||||
&cipher,
|
&cipher,
|
||||||
&User::update_uuid_revision(&user_uuid, &conn),
|
&[user_uuid.clone()]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,10 +184,12 @@ impl User {
|
|||||||
|
|
||||||
pub fn update_revision(&mut self, conn: &DbConn) -> EmptyResult {
|
pub fn update_revision(&mut self, conn: &DbConn) -> EmptyResult {
|
||||||
self.updated_at = Utc::now().naive_utc();
|
self.updated_at = Utc::now().naive_utc();
|
||||||
diesel::update(users::table.filter(users::uuid.eq(&self.uuid)))
|
crate::util::retry( || {
|
||||||
.set(users::updated_at.eq(&self.updated_at))
|
diesel::update(users::table.filter(users::uuid.eq(&self.uuid)))
|
||||||
.execute(&**conn)
|
.set(users::updated_at.eq(&self.updated_at))
|
||||||
.map_res("Error updating user revision")
|
.execute(&**conn)
|
||||||
|
}, 10)
|
||||||
|
.map_res("Error updating user revision")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn find_by_mail(mail: &str, conn: &DbConn) -> Option<Self> {
|
pub fn find_by_mail(mail: &str, conn: &DbConn) -> Option<Self> {
|
||||||
|
Loading…
Reference in New Issue
Block a user