File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ pub struct ClientConnectionSender {
79
79
sendtx : mpsc:: Sender < SerializableMessage > ,
80
80
abort_handle : AbortHandle ,
81
81
cancelled : AtomicBool ,
82
+ pub ( crate ) not_warned_failed_to_send_message : AtomicBool ,
82
83
83
84
/// Handles on Prometheus metrics related to connections to this database.
84
85
///
@@ -143,12 +144,14 @@ impl ClientConnectionSender {
143
144
144
145
let rx = MeteredReceiver :: new ( rx) ;
145
146
let cancelled = AtomicBool :: new ( false ) ;
147
+ let not_warned_failed_to_send_message = AtomicBool :: new ( true ) ;
146
148
let sender = Self {
147
149
id,
148
150
config,
149
151
sendtx,
150
152
abort_handle,
151
153
cancelled,
154
+ not_warned_failed_to_send_message,
152
155
metrics : None ,
153
156
} ;
154
157
( sender, rx)
@@ -418,12 +421,14 @@ impl ClientConnection {
418
421
let metrics = ClientConnectionMetrics :: new ( database_identity, config. protocol ) ;
419
422
let sendrx = MeteredReceiver :: with_gauge ( sendrx, metrics. sendtx_queue_size . clone ( ) ) ;
420
423
424
+ let not_warned_failed_to_send_message = AtomicBool :: new ( true ) ;
421
425
let sender = Arc :: new ( ClientConnectionSender {
422
426
id,
423
427
config,
424
428
sendtx,
425
429
abort_handle,
426
430
cancelled : AtomicBool :: new ( false ) ,
431
+ not_warned_failed_to_send_message,
427
432
metrics : Some ( metrics) ,
428
433
} ) ;
429
434
let this = Self {
Original file line number Diff line number Diff line change @@ -1522,7 +1522,9 @@ impl SendWorker {
1522
1522
1523
1523
fn send_to_client ( client : & ClientConnectionSender , message : impl Into < SerializableMessage > ) {
1524
1524
if let Err ( e) = client. send_message ( message) {
1525
- tracing:: warn!( %client. id, "failed to send update message to client: {e}" )
1525
+ if client. not_warned_failed_to_send_message . fetch_and ( false , Ordering :: AcqRel ) {
1526
+ tracing:: warn!( %client. id, "failed to send update message to client: {e}" )
1527
+ }
1526
1528
}
1527
1529
}
1528
1530
You can’t perform that action at this time.
0 commit comments