Use proper secret injected method for supervisor

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2025-09-04 14:46:37 +02:00
parent de6c799635
commit c6077623b0

View File

@@ -151,9 +151,22 @@ async fn deliver_one(
// Build supervisor method and params from Message
let method = msg.message.clone();
let params = build_params(&msg)?;
// Send
let out_id = client.call(&method, params).await?;
// If this is a job.run and we have a secret configured on the client,
// prefer the typed wrapper that injects the secret into inner supervisor params.
let out_id = if method == "job.run" {
if let Some(j) = msg.job.first() {
let jv = job_to_json(j)?;
// This uses SupervisorClient::job_run, which sets {"secret": "...", "job": <job>}
client.job_run(jv).await?
} else {
// Fallback: no embedded job, use the generic call
client.call(&method, params).await?
}
} else {
client.call(&method, params).await?
};
// Store transport id and initial Sent status
let _ = service