I am inserting a set of records on Google App Engine. I insert them in batch to avoid deadline exceptions.
When there is a large number of records (for example 1k) I always receive an unexpected:
Transaction collision for entity group with key
datastore_types.Key.from_path(u'GroupModel', u'root', _app=u'streamtomail'). Retrying...
This situation happen always.
In local environment instead it works without any problem.
How is it possible to have transaction collisions if I am using a sequential process and no one is using the system in the meanwhile?
Here is the code that I use for batching:
def deferred_worker():
if next_chunk():
process_chunk()
deferred.defer(deferred_worker)
where in *process_chunk()* I do 50 inserts in the database