Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Online store theme race condition on translaltion updates

Online store theme race condition on translaltion updates

thibaultdalban
Shopify Partner
6 0 0

Hi,

 

I'm updating theme translations for an online store via the GraphQL API (tested with versions 2024-01 and 2024-10). and discovered this process is subject to race conditions.

 

I’m delivering translations in 3 languages for an entire theme, with around 3,400 translations per language.

 

I’m using the translationsRegister mutation to deliver 100 translations per query. Each request can include translations for multiple languages.

Requests can include translations for different languages.

 

While I haven’t encountered any throttle errors, when I try to parallelize the queries, the result is an incomplete theme update.

 

When I compare locale files in the code editor, I notice that some keys are missing between versions.

 

My understanding is that each request creates a new version of the locale file, but the updates aren’t being merged properly.

 

 

thibaultdalban_0-1732574609203.png

 
That's the diff between the Current version and the version 335.
Before starting the delivery the de.json has been deleted, so we should have only additions in the diff.
 
image.png
 

Delivering each request one by one removes the race condition, but it's very slow because each request takes ~4s

to complete.

 

What's the most optimised way to deliver the translations for an entire theme?

Replies 0 (0)