Request may be translated to the wrong language due to race condition
#2
Closed
opened 6 years ago by trinity-1686a
·
2 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
There is a race condition due to use of a global variable to store language, if two request are made close enought, one will inherit the language of the other
How to reproduce :
Running one command then another give consistant results, but running both at the same time on different terminals sometime give inconsistant language result.
I don't know how this can be easily fixed as gettext-rs make heavy use of global state to store local
Yes, I think it is because Rocket is asynchronous as it uses threads. The only easy fix is to run the app with
ROCKET_WORKERS=1
, but that would result in lower performances and is not a possible solution.fixed by
1cede79b5d