Django: Race condition occurs in this block?

190 views Asked by At

I'm working with django-nonrel and django-rest-framework and I've got this view method who appends numbers into an array.

def add_number(self, request, *args, **kargs):
    row = self.get_object()                          # Gets the row from DB
    row.numbers.append(request.POST.get('number'))   # Modifies the column
    row.save()                                       # Save to DB
    serializer = self.get_serializer(row)
    return Response(serializer.data)

If another client attempts to add_number his number at the same concurrent time, Is it posible that one numbers does not remain stored?

Extra info

This is running in Google App Engine, with [email protected] and django-dbindexer, Google Cloud Datastore as database. Does @transaction.commit_on_success solve it? (I believe it doesn't)

0

There are 0 answers