Skip to content

Commit

Permalink
update: fix worker trigger for aws
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Dec 4, 2024
1 parent c1e3fe0 commit 4dca57b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/orchestrator/src/queue/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@ fn parse_job_message(message: &Delivery) -> Result<Option<JobQueueMessage>, Cons
/// Using string since localstack currently is instable with deserializing maps.
/// Change this to accept a map after localstack is stable
fn parse_worker_message(message: &Delivery) -> Result<Option<WorkerTriggerMessage>, ConsumptionError> {
let message: String =
message.payload_serde_json().expect("message processing failed").expect("message unwrapping failed");
let trigger_type = WorkerTriggerType::from_str(message.as_str()).expect("trigger type unwrapping failed");

let payload = message
.borrow_payload()
.ok_or_else(|| ConsumptionError::Other(OtherError::from("Empty payload".to_string())))?;
let message_string = String::from_utf8_lossy(payload).to_string().trim_matches('\"').to_string();
let trigger_type = WorkerTriggerType::from_str(message_string.as_str()).expect("trigger type unwrapping failed");
Ok(Some(WorkerTriggerMessage { worker: trigger_type }))
}

Expand Down

0 comments on commit 4dca57b

Please sign in to comment.