File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ pub struct ClientConnectionSender {
7979 sendtx : mpsc:: Sender < SerializableMessage > ,
8080 abort_handle : AbortHandle ,
8181 cancelled : AtomicBool ,
82+ pub ( crate ) not_warned_failed_to_send_message : AtomicBool ,
8283
8384 /// Handles on Prometheus metrics related to connections to this database.
8485 ///
@@ -143,12 +144,14 @@ impl ClientConnectionSender {
143144
144145 let rx = MeteredReceiver :: new ( rx) ;
145146 let cancelled = AtomicBool :: new ( false ) ;
147+ let not_warned_failed_to_send_message = AtomicBool :: new ( true ) ;
146148 let sender = Self {
147149 id,
148150 config,
149151 sendtx,
150152 abort_handle,
151153 cancelled,
154+ not_warned_failed_to_send_message,
152155 metrics : None ,
153156 } ;
154157 ( sender, rx)
@@ -418,12 +421,14 @@ impl ClientConnection {
418421 let metrics = ClientConnectionMetrics :: new ( database_identity, config. protocol ) ;
419422 let sendrx = MeteredReceiver :: with_gauge ( sendrx, metrics. sendtx_queue_size . clone ( ) ) ;
420423
424+ let not_warned_failed_to_send_message = AtomicBool :: new ( true ) ;
421425 let sender = Arc :: new ( ClientConnectionSender {
422426 id,
423427 config,
424428 sendtx,
425429 abort_handle,
426430 cancelled : AtomicBool :: new ( false ) ,
431+ not_warned_failed_to_send_message,
427432 metrics : Some ( metrics) ,
428433 } ) ;
429434 let this = Self {
Original file line number Diff line number Diff line change @@ -1522,7 +1522,12 @@ impl SendWorker {
15221522
15231523fn send_to_client ( client : & ClientConnectionSender , message : impl Into < SerializableMessage > ) {
15241524 if let Err ( e) = client. send_message ( message) {
1525- tracing:: warn!( %client. id, "failed to send update message to client: {e}" )
1525+ if client
1526+ . not_warned_failed_to_send_message
1527+ . fetch_and ( false , Ordering :: AcqRel )
1528+ {
1529+ tracing:: warn!( %client. id, "failed to send update message to client: {e}" )
1530+ }
15261531 }
15271532}
15281533
You can’t perform that action at this time.
0 commit comments