Skip to content

Commit

Permalink
perf(agent): Reduce polls for backup jobs
Browse files Browse the repository at this point in the history
TODO: Replace this with something deterministic
  • Loading branch information
adityahase committed Jan 16, 2025
1 parent ac2306c commit 2ae8724
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion press/press/doctype/agent_job/agent_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,16 @@ def filter_request_failures(servers):


def poll_pending_jobs():
filters = {"status": ("in", ["Pending", "Running", "Undelivered"])}
if random.random() > 0.1:
# Experimenting with fewer polls (only for backup jobs)
# Reduce poll frequency for Backup Site jobs
# TODO: Replace this with something deterministic
filters["job_type"] = ("!=", "Backup Site")
servers = frappe.get_all(
"Agent Job",
fields=["server", "server_type"],
filters={"status": ("in", ["Pending", "Running", "Undelivered"])},
filters=filters,
group_by="server",
order_by="",
ignore_ifnull=True,
Expand Down

0 comments on commit 2ae8724

Please sign in to comment.