Kamilski81
Kamilski81

Reputation: 15127

How do I increase timeout to stop google-cloud-vision DeadlineExceededError?

I am using 'google-cloud-vision' gem (v0.23.0) to do some image OCR and my requests randomly fail with: DeadlineExceededError. The error rate ranges from 1% to 99% failure, on a day-to-day basis, so it is very unpredictable.

When bypassing the gem and using the Google REST API, and passing in my image that is Base64Encoded, things seem flawless.

I'm guessing that the DeadlineExceededError is utilizing some timeout variable, whereas the REST api is not. So, I was wondering how to increase the Timeout as I don't feel right by using raw ruby code VS a library created by the company.

Upvotes: 0

Views: 959

Answers (1)

Sergey Sokolov
Sergey Sokolov

Reputation: 994

Looks like DeadlineExceededError occurred on 504 code from server, but relying on the code you can specify timeout manually - def vision scope: nil, timeout: nil, client_config: nil

So you can:

gcloud = Google::Cloud.new
vision = gcloud.vision timeout: 180

for sample.

Upvotes: 2

Related Questions