Skip to content

Commit

Permalink
fix: Do not run asynchronous commit in thread pool executor.
Browse files Browse the repository at this point in the history
  • Loading branch information
DABND19 committed Dec 21, 2024
1 parent 9caefa7 commit e1eb153
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion faststream/confluent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ async def start(self) -> None:

async def commit(self, asynchronous: bool = True) -> None:
"""Commits the offsets of all messages returned by the last poll operation."""
await call_or_await(self.consumer.commit, asynchronous=asynchronous)
if asynchronous:
# Asynchronous commit is non-blocking:
self.consumer.commit(asynchronous=True)
else:
await call_or_await(self.consumer.commit, asynchronous=False)

async def stop(self) -> None:
"""Stops the Kafka consumer and releases all resources."""
Expand Down

0 comments on commit e1eb153

Please sign in to comment.