Timeout issue when integrating custom translation API
-
Good evening
I followed the instructions for integrating a custom translation API and used the Mock Translation API as a reference. I modified it to simply call a Python API i made. First, it submits a request to be processed, then it keeps polling on the request’s status until it’s finished. The Python API creates a Job for the translation request and puts it in a Redis task queue. currently it simply sleeps for 120 seconds, for testing purposes (not sure if that’s relevant). Here’s the modified plugin.
The Python API takes quite some time to return results back. The problem is, before the API finishes processing the results, an error message comes up in the UI (see screenshot) saying “Blank response from server”, and in the debug console it says that a timeout occurred, and the error is coming from the file admin.js. I think it’s assumed somewhere that if the custom plugin doesn’t return a response within a certain time interval (i think 30 seconds), the application times out and gives the “Blank response” message.
I looked around in Loco plugin’s source code to try to find any clues on where that timeout occurs, I’m just speculating here but i think it’s in pub/js/min/admin.js
The thing is, this file is obfuscated, so I’m not really sure what I’m looking at.
I’m pretty sure the timeout is not coming from the custom plugin’s end because even after i see the timeout error on the console, i keep seeing that the API is being calling by translator.php.
I tried my best, being neither an expert in PHP nor WordPress. please advise. thanks
The topic ‘Timeout issue when integrating custom translation API’ is closed to new replies.