basis-company / nats.php

nats jetstream client for php
137 stars 32 forks source link

Publishing gives processing timeout exception #95

Open SuheylZ opened 2 months ago

SuheylZ commented 2 months ago

Whenever I try to publish the message, i get processing timeout at the following line

public function dispatch(string $name, mixed $payload, ?float $timeout = null)
    {
        if ($timeout === null) {
            $timeout = $this->configuration->timeout;
        }

        $context = (object) [
            'processed' => false,
            'result' => null,
            'threshold' => microtime(true) + $timeout,
        ];

        $this->request($name, $payload, function ($result) use ($context) {
            $context->processed = true;
            $context->result = $result;
        });

        while (!$context->processed && microtime(true) < $context->threshold) {
            $this->process();
        }

        if (!$context->processed) {
            throw new LogicException("Processing timeout");     // this causes exception
        }

        return $context->result;
    }

What should I do in this case? I'm running nats in docker and nats-box is not only able to onnect but also an publish mesages on that stream

ro0NL commented 3 weeks ago

it's probably more a server issue, than a client one. but im not 100% sure

we still see stream issue now&then

context_exception_file: vendor/basis-company/nats/src/Connection.php:138
context_exception_message: Error sending data

but we have a fallback MySQL connection, so OK