@@ -22,7 +22,7 @@ use sqlx::{query, query_as, Executor, PgConnection};
22
22
use thiserror:: Error ;
23
23
use thiserror_ext:: { Construct , ContextInto } ;
24
24
use tokio:: sync:: mpsc:: { self , Receiver , Sender } ;
25
- use tracing:: { error, info, warn, Level , Span } ;
25
+ use tracing:: { error, info, warn, Instrument , Level , Span } ;
26
26
use tracing_indicatif:: span_ext:: IndicatifSpanExt ;
27
27
use uuid:: Uuid ;
28
28
@@ -120,18 +120,21 @@ impl WriterConnectionPool {
120
120
match self . connection_rx . recv ( ) . await {
121
121
Some ( Ok ( mut connection) ) => {
122
122
let connection_tx = self . connection_tx . clone ( ) ;
123
- tokio:: task:: spawn ( async move {
124
- let to_return = match task ( & mut connection) . await {
125
- Ok ( ( ) ) => Ok ( connection) ,
126
- Err ( error) => {
127
- error ! ( "error in writer: {error}" ) ;
128
- Err ( error)
129
- }
130
- } ;
131
- // This should always succeed in sending unless we're already shutting
132
- // down for some other reason.
133
- let _: Result < _ , _ > = connection_tx. send ( to_return) . await ;
134
- } ) ;
123
+ tokio:: task:: spawn (
124
+ async move {
125
+ let to_return = match task ( & mut connection) . await {
126
+ Ok ( ( ) ) => Ok ( connection) ,
127
+ Err ( error) => {
128
+ error ! ( "error in writer: {error}" ) ;
129
+ Err ( error)
130
+ }
131
+ } ;
132
+ // This should always succeed in sending unless we're already shutting
133
+ // down for some other reason.
134
+ let _: Result < _ , _ > = connection_tx. send ( to_return) . await ;
135
+ }
136
+ . instrument ( tracing:: debug_span!( "spawn_with_connection" ) ) ,
137
+ ) ;
135
138
136
139
Ok ( ( ) )
137
140
}
0 commit comments