Skip to content

Commit

Permalink
fix:Convert KAFKA_CONSUMER_DEFAULT_TIMEOUT to an integer to avoid typ…
Browse files Browse the repository at this point in the history
…e error

If KAFKA_CONSUMER_DEFAULT_TIMEOUT is configured in the .env file, it will result in an error RdKafka\KafkaConsumer::consume(): Argument #1 ($timeout_ms) must be of type int, string given
  • Loading branch information
niuf416 authored Oct 10, 2024
1 parent 2adc207 commit bbca197
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Consumers/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function consumedMessagesCount(): int
*/
private function doConsume(): void
{
$message = $this->consumer->consume(config('kafka.consumer_timeout_ms', 2000));
$message = $this->consumer->consume((int) config('kafka.consumer_timeout_ms', 2000));
$this->handleMessage($message);
}

Expand Down

0 comments on commit bbca197

Please sign in to comment.