Skip to content

Commit

Permalink
Fix : create job error logs (#173)
Browse files Browse the repository at this point in the history
* fix : removed error return in create_job

* fix : removed error return in create_job

* fix : tests

* fix : test logic

* Update .env.test

Co-authored-by: Apoorv Sadana <95699312+apoorvsadana@users.noreply.github.com>

---------

Co-authored-by: Heemank Verma <heemankv@gmail.com>
Co-authored-by: Apoorv Sadana <95699312+apoorvsadana@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent 296c7a9 commit 4d61e3a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion crates/orchestrator/src/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions crates/orchestrator/src/tests/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion madara
2 changes: 1 addition & 1 deletion pathfinder
Submodule pathfinder updated 42 files
+26 −16 crates/common/src/error.rs
+6 −0 crates/common/src/receipt.rs
+164 −2 crates/common/src/state_update.rs
+18 −14 crates/executor/src/types.rs
+2 −0 crates/gateway-types/src/reply.rs
+14 −0 crates/make-stream/src/lib.rs
+27 −4 crates/merkle-tree/src/class.rs
+53 −5 crates/merkle-tree/src/contract.rs
+9 −8 crates/merkle-tree/src/contract_state.rs
+207 −120 crates/merkle-tree/src/tree.rs
+1 −1 crates/p2p/src/builder.rs
+48 −42 crates/p2p/src/client/conv.rs
+52 −13 crates/p2p/src/client/peer_agnostic.rs
+12 −2 crates/p2p/src/client/peer_agnostic/fixtures.rs
+1 −0 crates/p2p_proto/proto/class.proto
+1 −0 crates/p2p_proto/proto/transaction.proto
+26 −5 crates/p2p_proto/src/class.rs
+25 −20 crates/p2p_proto/src/transaction.rs
+2 −2 crates/pathfinder/examples/re_execute.rs
+7 −1 crates/pathfinder/src/p2p_network/sync_handlers.rs
+3 −3 crates/pathfinder/src/p2p_network/sync_handlers/tests.rs
+0 −1 crates/pathfinder/src/state.rs
+7 −18 crates/pathfinder/src/state/sync.rs
+4 −4 crates/pathfinder/src/sync.rs
+7 −12 crates/pathfinder/src/sync/checkpoint.rs
+27 −0 crates/pathfinder/src/sync/checkpoint/fixture.rs
+4 −0 crates/pathfinder/src/sync/error.rs
+209 −8 crates/pathfinder/src/sync/state_updates.rs
+2 −6 crates/pathfinder/src/sync/track.rs
+23 −6 crates/rpc/src/dto/fee.rs
+11 −5 crates/rpc/src/dto/receipt.rs
+4 −5 crates/rpc/src/lib.rs
+120 −80 crates/rpc/src/method/estimate_fee.rs
+12 −8 crates/rpc/src/method/estimate_message_fee.rs
+76 −92 crates/rpc/src/method/get_storage_proof.rs
+33 −17 crates/rpc/src/pathfinder/methods/get_proof.rs
+46 −31 crates/rpc/src/v06/method/estimate_fee.rs
+12 −8 crates/rpc/src/v06/method/estimate_message_fee.rs
+4 −4 crates/rpc/src/v06/method/simulate_transactions.rs
+1 −0 crates/rpc/src/v08.rs
+1 −0 crates/storage/src/connection/transaction.rs
+1 −0 crates/storage/src/test_utils.rs

0 comments on commit 4d61e3a

Please sign in to comment.