File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,7 +374,20 @@ impl TransactionalProducer {
374374 let record = BaseRecord :: to ( & self . progress_topic )
375375 . payload ( & payload)
376376 . key ( & self . progress_key ) ;
377- self . producer . send ( record) . map_err ( |( e, _) | e) ?;
377+ match self . producer . send ( record) {
378+ Ok ( ( ) ) => { }
379+ Err ( ( err, record) ) => match err. rdkafka_error_code ( ) {
380+ Some ( RDKafkaErrorCode :: QueueFull ) => {
381+ // If the internal rdkafka queue is full we have no other option than to flush
382+ // TODO(petrosagg): remove this logic once we fix the issue that cannot be
383+ // named
384+ let timeout = self . transaction_timeout ;
385+ self . spawn_blocking ( move |p| p. flush ( timeout) ) . await ?;
386+ self . producer . send ( record) . map_err ( |( err, _) | err) ?;
387+ }
388+ _ => return Err ( err. into ( ) ) ,
389+ } ,
390+ }
378391
379392 let timeout = self . socket_timeout ;
380393 match self
You can’t perform that action at this time.
0 commit comments