I suddenly remembered this channel. I want to share how I solved my problem and happily report that I managed to solve it very

I've known for a long time about the "race condition" problem in programming, where processes in threads don't execute in the order the programmer expects, and now I've finally run into it head-on.
What was the issue, and how did we fix it? There’s a method for writing a token to the data store and a method for retrieving information from the server, which first fetches the token from the data store. So you’ve probably already figured out the order in which everything was executed when the token changed. That’s right—first we sent the new token to be saved, then we made a request to the server using the old token, and only then was the new token saved. We were able to fix it quickly and, it seems, without any major workarounds.