Register runner when starting script

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2025-09-04 17:36:21 +02:00
parent 059d5131e7
commit c38937f1cb
4 changed files with 93 additions and 6 deletions

View File

@@ -55,6 +55,8 @@ impl MyceliumClient {
"method": method,
"params": [ params ]
});
tracing::info!(%req, "jsonrpc");
let resp = self.http.post(&self.base_url).json(&req).send().await?;
let status = resp.status();
let body: Value = resp.json().await?;

View File

@@ -208,7 +208,7 @@ impl SupervisorClient {
.mycelium
.push_message(
&self.destination,
&self.topic,
&Self::encode_topic(self.topic.as_bytes()),
&payload_b64,
Some(reply_timeout_secs),
)

View File

@@ -522,10 +522,7 @@ pub fn start_inbound_listener(
loop {
// Poll for inbound supervisor messages on the configured topic
match mycelium
.pop_message(Some(false), Some(20), Some(cfg.topic.as_str()))
.await
{
match mycelium.pop_message(Some(false), Some(20), None).await {
Ok(Some(inb)) => {
// Expect InboundMessage with base64 "payload"
let Some(payload_b64) = inb.get("payload").and_then(|v| v.as_str()) else {
@@ -545,6 +542,10 @@ pub fn start_inbound_listener(
.await;
continue;
};
tracing::info!(
raw = %String::from_utf8_lossy(&raw),
"Read raw messge from mycelium"
);
let Ok(rpc): Result<Value, _> = serde_json::from_slice(&raw) else {
// Invalid JSON payload
continue;