@@ -23,10 +23,12 @@ def compile_release_batch(collection, ocids):
2323 Compile the OCIDs in bulk.
2424
2525 Idempotent under duplicate message delivery, provided this is called within a transaction that also deletes the
26- COMPILE steps, so that the compiled release insertions and processing step deletions commit together. Two messages
27- never carry partially overlapping OCIDs: the compiler command sets compilation_started with an optimistic lock and
28- publishes each collection's OCIDs once, partitioned into disjoint batches. So the only duplicate is a redelivery of
29- the same message:
26+ COMPILE steps, so that the compiled release insertions and processing step deletions commit together.
27+
28+ Two messages never partially overlap on OCIDs: the compiler command sets compilation_started with an optimistic
29+ lock and publishes each collection's OCIDs once, partitioned into disjoint batches.
30+
31+ So, the only duplicate is a redelivery of the same message, in which case:
3032
3133 - A sequential redelivery is a no-op: already-compiled OCIDs are filtered out below, before any insert.
3234 - A concurrent redelivery is safe: CollectionFile's unique (collection, filename) constraint lets only one of the
@@ -37,7 +39,6 @@ def compile_release_batch(collection, ocids):
3739 :param ocids: the OCIDs to compile
3840 :returns: the OCIDs that were compiled
3941 """
40- # Skip OCIDs that are already compiled (idempotent under redelivery; see the docstring).
4142 already_exists = set (
4243 CompiledRelease .objects .filter (collection = collection , ocid__in = ocids ).values_list ("ocid" , flat = True )
4344 )
0 commit comments