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
Comment | File | Size | Author |
---|---|---|---|
#1 | tmgmt_mygengo-configurable-request-timeout.patch | 2.82 KB | das-peter |
Comments
Comment #1
das-peter CreditAttribution: das-peter commentedPatch lost?!? Let's try this again :)
Comment #2
miro_dietikerAnd the 60secs then helped?
I suggest also to ask Gengo to make the API more stable and faster .-)
Comment #3
das-peter CreditAttribution: das-peter commentedFrankly speaking I used brute force and set it to 300 seconds ;)
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...
Comment #4
miro_dietikerSure, it seems we should add this.
I have contacted our key account manager at gengo to check this report. Stay tuned for some reply.
Comment #5
miro_dietikerGengo 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.
Comment #6
das-peter CreditAttribution: das-peter commentedNice 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
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.
Comment #8
das-peter CreditAttribution: das-peter commentedPostpone, since this patch isn't necessary if the gengo API performs as it should ;)