diff --git a/src/alert/base.rs b/src/alert/base.rs index 238dcbeb..45387703 100644 --- a/src/alert/base.rs +++ b/src/alert/base.rs @@ -1294,10 +1294,6 @@ pub trait AlertWorker { .update_one(find_doc, update_doc) .await?; if update_result.matched_count == 0 { - warn!( - "Concurrent modification detected for object_id {}. Using DB-only update.", - object_id - ); return Err(AlertError::ConcurrentAuxUpdate(object_id.to_string())); } Ok(()) diff --git a/src/alert/decam.rs b/src/alert/decam.rs index 1eb06ec1..402eb3d4 100644 --- a/src/alert/decam.rs +++ b/src/alert/decam.rs @@ -23,7 +23,7 @@ use flare::Time; use mongodb::bson::{doc, Document}; use serde::{Deserialize, Deserializer, Serialize}; use serde_with::{serde_as, skip_serializing_none}; -use tracing::{instrument, warn}; +use tracing::{debug, error, instrument, warn}; pub const STREAM_NAME: &str = "DECAM"; pub const DECAM_DEC_RANGE: (f64, f64) = (-90.0, 33.5); @@ -279,10 +279,7 @@ impl DecamAlertWorker { .await } - #[instrument( - skip(self, prv_candidates, fp_hists, survey_matches, existing_alert_aux), - err - )] + #[instrument(skip(self, prv_candidates, fp_hists, survey_matches, existing_alert_aux))] async fn update_aux_inner( &mut self, object_id: &str, @@ -342,9 +339,13 @@ impl DecamAlertWorker { .await { Ok(_) => Ok(()), - Err(_) => { + Err(e) => { // if we get a concurrent modification error or an error preparing the lightcurves update, // we fallback to a full in-DB update, safe against concurrency and "self-healing", but less efficient + match &e { + AlertError::ConcurrentAuxUpdate(_) => debug!(error = %e), + _ => error!(error = %e), + } self.update_aux_fallback(object_id, prv_candidates, fp_hists, survey_matches, now) .await } diff --git a/src/alert/lsst.rs b/src/alert/lsst.rs index 2a6db81e..6634930f 100644 --- a/src/alert/lsst.rs +++ b/src/alert/lsst.rs @@ -25,7 +25,7 @@ use mongodb::bson::{doc, Document}; use serde::{Deserialize, Deserializer, Serialize}; use serde_with::{serde_as, skip_serializing_none}; use std::collections::HashMap; -use tracing::{instrument, warn}; +use tracing::{debug, error, instrument, warn}; use utoipa::ToSchema; pub const STREAM_NAME: &str = "LSST"; @@ -1022,10 +1022,7 @@ impl LsstAlertWorker { .await } - #[instrument( - skip(self, prv_candidates, fp_hists, survey_matches, existing_alert_aux), - err - )] + #[instrument(skip(self, prv_candidates, fp_hists, survey_matches, existing_alert_aux))] async fn update_aux_inner( &mut self, object_id: &str, @@ -1089,9 +1086,13 @@ impl LsstAlertWorker { .await { Ok(_) => Ok(()), - Err(_) => { + Err(e) => { // if we get a concurrent modification error or an error preparing the lightcurves update, // we fallback to a full in-DB update, safe against concurrency and "self-healing", but less efficient + match &e { + AlertError::ConcurrentAuxUpdate(_) => debug!(error = %e), + _ => error!(error = %e), + } self.update_aux_fallback(object_id, prv_candidates, fp_hists, survey_matches, now) .await } diff --git a/src/alert/ztf.rs b/src/alert/ztf.rs index db1f3fcf..148a7022 100644 --- a/src/alert/ztf.rs +++ b/src/alert/ztf.rs @@ -21,7 +21,7 @@ use mongodb::bson::{doc, Document}; use serde::{Deserialize, Deserializer, Serialize}; use serde_with::{serde_as, skip_serializing_none}; use std::collections::HashMap; -use tracing::{instrument, warn}; +use tracing::{debug, error, instrument, warn}; use utoipa::ToSchema; pub const STREAM_NAME: &str = "ZTF"; @@ -791,17 +791,14 @@ impl ZtfAlertWorker { .await } - #[instrument( - skip( - self, - prv_candidates, - prv_nondetections, - fp_hists, - survey_matches, - existing_alert_aux - ), - err - )] + #[instrument(skip( + self, + prv_candidates, + prv_nondetections, + fp_hists, + survey_matches, + existing_alert_aux + ))] async fn update_aux_inner( &mut self, object_id: &str, @@ -875,9 +872,13 @@ impl ZtfAlertWorker { .await { Ok(_) => Ok(()), - Err(_) => { + Err(e) => { // if we get a concurrent modification error or an error preparing the lightcurves update, // we fallback to a full in-DB update, safe against concurrency and "self-healing", but less efficient + match &e { + AlertError::ConcurrentAuxUpdate(_) => debug!(error = %e), + _ => error!(error = %e), + } self.update_aux_fallback( object_id, prv_candidates,