Skip to content

Commit

Permalink
Fix/improvements (#207)
Browse files Browse the repository at this point in the history
* update: added delay between cron rule & creation

* update: added min_block_to_process for state_update worker

* added: changelog
  • Loading branch information
heemankv authored Feb 7, 2025
1 parent bceafa0 commit 3c795aa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Fixed

- corrected delays in cloud setup
- fixed state_update worker to continue from min_block_no_to_process
- fixed JOB_METADATA_PROCESSING_COMPLETED_AT usage
- add jemallocator to fix memory leak
- refactor: instrumentation
Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/cron/event_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Cron for AWSEventBridge {
"Statement": [{
"Effect": "Allow",
"Principal": {
"Service": "scheduler.amazonaws.com"
"Service": ["scheduler.amazonaws.com", "events.amazonaws.com"]
},
"Action": "sts:AssumeRole"
}]
Expand Down
4 changes: 4 additions & 0 deletions crates/orchestrator/src/cron/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::time::Duration;

use async_trait::async_trait;
use lazy_static::lazy_static;
use tokio::time::sleep;

use crate::queue::job_queue::WorkerTriggerType;

Expand Down Expand Up @@ -30,6 +33,7 @@ pub trait Cron {
async fn setup(&self) -> color_eyre::Result<()> {
let trigger_arns = self.create_cron().await?;
for trigger in WORKER_TRIGGERS.iter() {
sleep(Duration::from_secs(15)).await;
self.add_cron_target_queue(trigger, &trigger_arns).await?;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/orchestrator/src/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub async fn setup_cloud(setup_cmd: &SetupCmd) -> color_eyre::Result<()> {
// Cron
println!("Setting up cron. ⏳");
// Sleeping for few seconds to let AWS index the newly created queues to be used for setting up cron
sleep(Duration::from_secs(100)).await;
sleep(Duration::from_secs(60)).await;
let cron_params = setup_cmd.validate_cron_params().expect("Failed to validate cron params");
match cron_params {
CronValidatedArgs::AWSEventBridge(aws_event_bridge_params) => {
Expand Down
3 changes: 2 additions & 1 deletion crates/orchestrator/src/workers/update_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ impl Worker for UpdateStateWorker {
}
}
None => {
if blocks_to_process[0] != 0 {
let min_block_to_process = config.service_config().min_block_to_process.unwrap_or(0);
if blocks_to_process[0] != min_block_to_process {
log::warn!("DA job for the first block is not yet completed. Returning safely...");
return Ok(());
}
Expand Down

0 comments on commit 3c795aa

Please sign in to comment.