diff --git a/.env.test b/.env.test index dd61c0db..363e4933 100644 --- a/.env.test +++ b/.env.test @@ -73,7 +73,7 @@ L1_CORE_CONTRACT_ADDRESS="0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057" ##### SNOS ##### ## This is needed right now because Madara doesn't support getProof -RPC_FOR_SNOS="" +RPC_FOR_SNOS="http://localhost:9545" ##### STARKNET SETTLEMENT ##### diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a92b4c..0fdc6648 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## Changed +- removed error return in case of JobAlreadyExists in `create_job` function - update_job returns the updated job item - made create_job atomic to avoid race conditions - handle jobs in tokio tasks diff --git a/crates/orchestrator/src/jobs/mod.rs b/crates/orchestrator/src/jobs/mod.rs index 9e55a45a..476a81bd 100644 --- a/crates/orchestrator/src/jobs/mod.rs +++ b/crates/orchestrator/src/jobs/mod.rs @@ -165,7 +165,8 @@ pub async fn create_job( // this is technically a redundant check, we've another check inside `create_job` if existing_job.is_some() { - return Err(JobError::JobAlreadyExists { internal_id, job_type }); + tracing::warn!("{}", JobError::JobAlreadyExists { internal_id, job_type }); + return Ok(()); } let job_handler = factory::get_job_handler(&job_type).await; diff --git a/crates/orchestrator/src/tests/jobs/mod.rs b/crates/orchestrator/src/tests/jobs/mod.rs index a04b1ce8..ecb204b6 100644 --- a/crates/orchestrator/src/tests/jobs/mod.rs +++ b/crates/orchestrator/src/tests/jobs/mod.rs @@ -98,9 +98,10 @@ async fn create_job_job_exists_in_db_works() { let database_client = services.config.database(); database_client.create_job(job_item.clone()).await.unwrap(); - assert!( - create_job(JobType::ProofCreation, "0".to_string(), HashMap::new(), services.config.clone()).await.is_err() - ); + assert!(create_job(JobType::ProofCreation, "0".to_string(), HashMap::new(), services.config.clone()).await.is_ok()); + // There should be only 1 job in the db + let jobs_in_db = database_client.get_jobs_by_statuses(vec![JobStatus::Created], None).await.unwrap(); + assert_eq!(jobs_in_db.len(), 1); // Waiting for 5 secs for message to be passed into the queue sleep(Duration::from_secs(5)).await; diff --git a/madara b/madara index 93d57632..d188aa91 160000 --- a/madara +++ b/madara @@ -1 +1 @@ -Subproject commit 93d57632e7a56707d74ab63eb0ca8558df9f0d8e +Subproject commit d188aa91efa78bcc54f92aa1035295fd50e068d2 diff --git a/pathfinder b/pathfinder index 138140e5..29f93d0d 160000 --- a/pathfinder +++ b/pathfinder @@ -1 +1 @@ -Subproject commit 138140e5fd967ede92806fd62de47c2e6b65712a +Subproject commit 29f93d0d6ad8758fdcf5ae3a8bd2faad2a3bc92b