Skip to content

Commit 6af6e6d

Browse files
committed
Overlooked comment.
Addresses: #524 (comment)
1 parent 8bd5059 commit 6af6e6d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gcloud/datastore/batch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ def _assign_entity_to_mutation(mutation_pb, entity, auto_id_entities):
300300
insert = mutation_pb.insert_auto_id.add()
301301
auto_id_entities.append(entity)
302302
else:
303+
# We use ``upsert`` for entities with completed keys, rather than
304+
# ``insert`` or ``update``, in order not to create race conditions
305+
# based on prior existence / removal of the entity.
303306
insert = mutation_pb.upsert.add()
304307

305308
insert.key.CopyFrom(key_pb)

0 commit comments

Comments
 (0)