Skip to content

Commit 7611f39

Browse files
committed
Address comments
1 parent d7b64ce commit 7611f39

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,16 @@ async fn run_listener(input: RunListenerInput) -> Result<(), PubsubClientError>
105105

106106
match Observation::try_new(body, input.secret_key) {
107107
Ok(observation) => {
108-
if let Err(e) = input.api_client.post_observation(observation).await {
109-
tracing::error!(error = ?e, "Failed to post observation");
110-
} else {
111-
tracing::info!("Observation posted successfully");
112-
}
108+
tokio::spawn({
109+
let api_client = input.api_client.clone();
110+
async move {
111+
if let Err(e) = api_client.post_observation(observation).await {
112+
tracing::error!(error = ?e, "Failed to post observation");
113+
} else {
114+
tracing::info!("Observation posted successfully");
115+
}
116+
}
117+
});
113118
}
114119
Err(e) => tracing::error!(error = ?e, "Failed to create observation"),
115120
};

0 commit comments

Comments
 (0)