The discussion revolves around the issue of custom fields being updated simultaneously, causing values to turn into arrays. Stefan_Brighiu_M initially thought this was a fixed bug, but is now experiencing it with multiple endpoints updating user custom fields at the same time.
He considered implementing a lock on the database until the values are saved, and fzngagan suggested a previously fixed bug as a potential solution. However, Stefan_Brighiu_M is dealing with sensitive payment data and multiple sources of calls, making it challenging to minimize the calls.
eviltrout suggested three possible solutions: adding a unique index on the custom field, using a DistributedMutex, or redesigning the table. Stefan_Brighiu_M successfully implemented the DistributedMutex solution and plans to run the calls one by one to prevent future issues. He thanked eviltrout and fzngagan for their help.
Unfortunately, I am now dealing with simultaneous endpoints being called that update the user custom_fields at the same time, making the values set by me as :text to turn into arrays.
Any help? This blocks my entire project right now…
Running into this problem on 2.5.0.beta7 in local development.
Is there any way I can make a lock on the db until the values are saved, in this situation?
Note that when two transaction run concurrently in two threads, each thread doesn’t see the other transaction’s changes until they are committed successfully. It does however see its own changes (this is a dumbed-down explanation, reality is much more complicated).
Unfortunately I am now faced with updating sensitive data potentially at the same time. I think this happens because I am doing it via endpoints, but this is the only way I can do it and I do no have control over the calls. It can be 1 call, it can be 10.
I can try to minimize the calls from the app and bulk send some data, the problem is there are 2 sources for the calls: mobile and external services.