File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,16 @@ async fn run_listener(input: RunListenerInput) -> Result<(), PubsubClientError>
105
105
106
106
match Observation :: try_new ( body, input. secret_key ) {
107
107
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
+ } ) ;
113
118
}
114
119
Err ( e) => tracing:: error!( error = ?e, "Failed to create observation" ) ,
115
120
} ;
You can’t perform that action at this time.
0 commit comments