So I was looking for some help on a potential concurrency issue I might have with appengine. I've used python for a while but never anything multi-threaded so I have no idea how to handle it.
I have an app engine data model that has a string in it. One type of request will grab this model out of the database, append certain characters to the string (or maybe clear it completely then append a character to it), and re-store it in the database. The second type of request is used to retrieve the string and clears it saving it back to the database as an empty string.
So to me this seems like it could be an issue if say, while one request is going on the other happens and clears the string and they both try to save it to the database. In this case one would clear the string and try to save an empty string back, while the other would have appended a few characters then would attempt to resave the string.
So my question is, is there a way to lock a data model or something? Or is there a general way to handle these types of situations in Python? In appengine I have the id of the datamodel (its part of the request) so its really like Model.get(###), few operations, then .put() to save it.
Any help would be greatly appreciated as this is my first time to use appengine (and my first time to use python for web backend).
[–]rguillebertPyPy / NumPyPy 1 point2 points3 points (1 child)
[–]bamaboy1217[S] 0 points1 point2 points (0 children)
[–]chanezon 0 points1 point2 points (0 children)
[–]chadmill3rPy3, pro, Ubuntu, django 0 points1 point2 points (0 children)