Skip to content

Commit

Permalink
Execute KafkaProducer#send calls directly and not on the blocking thr…
Browse files Browse the repository at this point in the history
…ead pool

See #531
  • Loading branch information
svroonland committed Nov 22, 2022
1 parent b307c6f commit eab06b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zio-kafka/src/main/scala/zio/kafka/producer/Producer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ object Producer {
done <- Promise.make[Throwable, RecordMetadata]
serializedRecord <- serialize(record, keySerializer, valueSerializer)
runtime <- ZIO.runtime[Any]
_ <- ZIO.attemptBlocking {
_ <- ZIO.attempt {
p.send(
serializedRecord,
new Callback {
Expand All @@ -163,7 +163,7 @@ object Producer {
done <- Promise.make[Throwable, Chunk[RecordMetadata]]
runtime <- ZIO.runtime[Any]
serializedRecords <- ZIO.foreach(records.toSeq)(serialize(_, keySerializer, valueSerializer))
_ <- ZIO.attemptBlocking {
_ <- ZIO.attempt {
val it: Iterator[(ByteRecord, Int)] =
serializedRecords.iterator.zipWithIndex
val res: Array[RecordMetadata] = new Array[RecordMetadata](records.length)
Expand Down

0 comments on commit eab06b9

Please sign in to comment.