timkley / weaviate-php

A PHP client to communicate with a Weaviate instance
MIT License
26 stars 9 forks source link

Cannot set client timeout? #10

Open bbrala opened 2 months ago

bbrala commented 2 months ago

We now keep getting timeouts when pushing batches. Weaviate seems to complete in 36 seconds, but when i try to set the timeout on Api->httpClient it doesn't get updated at all. :(

In PendingRequest.php line 926:
  cURL error 28: Operation timed out after 30002 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://weaviate.weaviate-sharded/v1/batch/objects

In CurlFactory.php line 210:

  cURL error 28: Operation timed out after 30002 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://weaviate.weaviate-sharded/v1/batch/objects

The (hacky) code i tried:

        $this->client = new Weaviate($options['url'], $options['key'], $options['extra_http_headers'] ?? []);
        $this->client->api->httpClient->timeout(60);

Not sure how to work around this. Any ideas?

bbrala commented 2 months ago

@jormeijer (colleague so he gets notified)

timkley commented 2 months ago

@bbrala this possibly didn't work because the client is already stored and you can't change the instance like you did.

I've just commited the option to instantiate the Weaviate client with a new optional timeout parameter for the time being. In the future I might allow to just swap out the client, but currently I don't have the time for a refactor like this.

I've tagged v0.8.0, please let me know if this works for you guys.

timkley commented 21 hours ago

@bbrala @jormeijer is this working for you?