Problem/Motivation

Our requests to the gengo api quite often end up in Job has been rejected with following error: Unable to connect to myGengo service due to following error: request timed out at http://api.gengo.com/v2/translate/jobs
The problem seems to be that drupal_http_request() runs into a timeout using the (slow) gengo api.

Proposed resolution

Add option to configure the request timeout for drupal_http_request() when using the gengo api.
Attached patch does that and fixes some minor coding standard issues.
It also sets a default timeout for the gengo api of 60sec while the default of drupal_http_request() is 30sec.

Remaining tasks

Reviews needed.

User interface changes

New form element in the translator configuration form.

API changes

none

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter’s picture

Patch lost?!? Let's try this again :)

miro_dietiker’s picture

And the 60secs then helped?

I suggest also to ask Gengo to make the API more stable and faster .-)

das-peter’s picture

And the 60secs then helped?

Frankly speaking I used brute force and set it to 300 seconds ;)

I suggest also to ask Gengo to make the API more stable and faster .-)

Totally, but meanwhile it would be nice to be able to use the snail-mail style api :P
Seriously, within the last weeks the default 30 seconds lead in 95% of the cases to a timeout, but I didn't measure the response times and simply increased insanely now...

miro_dietiker’s picture

Sure, it seems we should add this.

I have contacted our key account manager at gengo to check this report. Stay tuned for some reply.

miro_dietiker’s picture

Gengo confirmed this job submission performance problem which is sometimes present since a week.

They're working hard to fix this issue ASAP.
We can still add this configurability to the system, but it should definitively not be needed once the system is at normal status again.

das-peter: If it fails, do we fail gracefully?
For me this is even more important than the limit itself.

das-peter’s picture

They're working hard to fix this issue ASAP.

Nice to hear that. If this works out and such a case doesn't happen again there's basically no need for this patch. So I could set the priority to minor :P

If it fails, do we fail gracefully?

I'd say it's graceful it shows a message that the submission failed and you've this entry in the job log: Job has been rejected with following error: Unable to connect to myGengo service due to following error: request timed out at http://api.gengo.com/v2/translate/jobs
The job is still working (nothing of the configuration is lost) and you can submit it again without having to change anything.

Status: Needs review » Needs work

The last submitted patch, tmgmt_mygengo-configurable-request-timeout.patch, failed testing.

das-peter’s picture

Status: Needs work » Postponed

Postpone, since this patch isn't necessary if the gengo API performs as it should ;)