From 9424605cfbca186d71856a16ca8355d1b20f224c Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Tue, 21 Sep 2021 12:14:32 +0100 Subject: [PATCH] Retry on foreign key violation --- Cargo.toml | 4 ++-- sqlxmq_macros/Cargo.toml | 2 +- src/lib.rs | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ece3ced..2623231 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlxmq" -version = "0.3.0" +version = "0.3.1" authors = ["Diggory Blake "] edition = "2018" license = "MIT OR Apache-2.0" @@ -23,7 +23,7 @@ uuid = { version = "0.8.2", features = ["v4"] } log = "0.4.14" serde_json = "1.0.64" serde = "1.0.124" -sqlxmq_macros = { version = "0.3.0", path = "sqlxmq_macros" } +sqlxmq_macros = { version = "0.3.1", path = "sqlxmq_macros" } anymap2 = "0.13.0" [features] diff --git a/sqlxmq_macros/Cargo.toml b/sqlxmq_macros/Cargo.toml index ff4b209..f1955c0 100644 --- a/sqlxmq_macros/Cargo.toml +++ b/sqlxmq_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlxmq_macros" -version = "0.3.0" +version = "0.3.1" authors = ["Diggory Blake "] edition = "2018" license = "MIT OR Apache-2.0" diff --git a/src/lib.rs b/src/lib.rs index 1dff820..fa20ec5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -243,6 +243,8 @@ pub fn should_retry(error: &sqlx::Error) -> bool { // It's more readable as a match #[allow(clippy::match_like_matches_macro)] match (db_error.code().as_deref(), db_error.constraint().as_deref()) { + // Foreign key constraint violation on ordered channel + (Some("23503"), Some("mq_msgs_after_message_id_fkey")) => true, // Unique constraint violation on ordered channel (Some("23505"), Some("mq_msgs_channel_name_channel_args_after_message_id_idx")) => true, // Serialization failure