Skip to content

[kafka] Useless while? #981

@TiMESPLiNTER

Description

@TiMESPLiNTER

I have a question regarding these lines in the kafka consumer:

https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/rdkafka/RdKafkaConsumer.php#L103-L111

        if ($timeout > 0) {
            $message = $this->doReceive($timeout);
        } else {
            while (true) {
                if ($message = $this->doReceive(500)) {
                    break;
                }
            }
        }

just out of curiosity: why isn't this written like this?

        if ($timeout > 0) {
            $timeout = 500;
        }

        $message = $this->doReceive($timeout);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions