Skip to content
Snippets Groups Projects
Commit f16b3cf2 authored by ml bonhomme's avatar ml bonhomme :bee:
Browse files

Use default db when retrieving active agents in Agent.next_tasks

parent 76138863
No related branches found
No related tags found
1 merge request!2169Use default db when retrieving active agents in Agent.next_tasks
......@@ -212,9 +212,10 @@ class Agent(models.Model):
if not pending_tasks.exists():
return []
# Retrieve active agents within the same farm
# Retrieve active agents within the same farm, using the default database to avoid a stale-read if there are
# no active agents, then an agent becomes active and asks for its actions
active_agents = (
Agent.objects
Agent.objects.using('default')
.filter(
last_ping__gte=timezone.now() - AGENT_TIMEOUT,
farm_id=self.farm_id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment