-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] Make http requests synchronous when reading the Loco API #44416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Translation] Make http requests synchronous when reading the Loco API #44416
Conversation
Checks failures are unrelated I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is legitimate, as you profiled it and there is no big difference I'm ok to merge it. Thank you @Kocal
BTW, is anyone in touch with Loco, because so far they didn't answer to our ping to back the bridge. (Crowdin and Lokalise did, so you know which bridge you'd better use ;) ) |
The two foreach have been merged! |
I suggest adding a comment in the code mentioning that the Loco API forbids concurrent requests, to explain why this provider does not take advantage of the request concurrency allowed by http-client (so that it does not get refactored in the opposite way by someone not knowing about this API limitation). |
They answered us quite quickly about this issue, I contacted them via their contact form 🤷 |
A comment has been added, thanks for your reviews. |
Thank you @Kocal. |
Hi!
Since we migrated from the PHP Translation's Loco Adapter to the Symfony's Loco Translation Provider, we started to have 429 errors from the Loco API when running our CI or deploying our code on review apps/staging/production environments:
Some screenshots
We have asked to the Loco support and this is their response:
Which makes sense. AFAIK, the PHP Translation's Loco Adapter makes synchronous requests to get translations from Loco.
Some Blackfire traces, it does not impact performances:
I consider this PR as a bug-fix and not a feature, that's why I've targeted 5.3.
WDYT?
ping @welcoMattic