File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,8 @@ def calculate_chargeable() -> dict[str, int | None]:
232232 # Acquire lock to prevent race conditions between concurrent charge calls
233233 # (e.g., when Actor.push_data with charging is called concurrently with Actor.charge).
234234 async with self ._charge_lock :
235+ # START OF CRITICAL SECTION
236+
235237 # Determine the maximum amount of events that can be charged within the budget
236238 max_chargeable = self .calculate_max_event_charge_count_within_limit (event_name )
237239 charged_count = min (count , max_chargeable if max_chargeable is not None else count )
@@ -279,6 +281,8 @@ def calculate_chargeable() -> dict[str, int | None]:
279281 }
280282 )
281283
284+ # END OF CRITICAL SECTION
285+
282286 # If it is not possible to charge the full amount, log that fact
283287 if charged_count < count :
284288 subject = 'instance' if count == 1 else 'instances'
You can’t perform that action at this time.
0 commit comments