Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,11 @@ def _fetch_folder_rules(folder_id: str):
try:
data = _api_get(client, f"{API_BASE}/{profile_id}/rules/{folder_id}").json()
folder_rules = data.get("body", {}).get("rules", [])
with all_rules_lock:
for rule in folder_rules:
if rule.get("PK"):
all_rules.add(rule["PK"])
# Optimization: Extract PKs locally to minimize lock contention
local_pks = {rule["PK"] for rule in folder_rules if rule.get("PK")}
if local_pks:
with all_rules_lock:
all_rules.update(local_pks)
except httpx.HTTPError:
pass
except Exception as e:
Expand Down
Loading