remove old task
This commit is contained in:
parent
0e3d04873d
commit
0b9c220fbb
|
@ -29,26 +29,6 @@ def _check_agent_service(pk: int) -> None:
|
|||
asyncio.run(agent.nats_cmd(data, wait=False))
|
||||
|
||||
|
||||
def _check_in_full(pk: int) -> None:
|
||||
agent = Agent.objects.get(pk=pk)
|
||||
asyncio.run(agent.nats_cmd({"func": "checkinfull"}, wait=False))
|
||||
|
||||
|
||||
@app.task
|
||||
def check_in_task() -> None:
|
||||
q = Agent.objects.only("pk", "version")
|
||||
agents: List[int] = [
|
||||
i.pk for i in q if pyver.parse(i.version) == pyver.parse("1.1.12")
|
||||
]
|
||||
chunks = (agents[i : i + 50] for i in range(0, len(agents), 50))
|
||||
for chunk in chunks:
|
||||
for pk in chunk:
|
||||
_check_in_full(pk)
|
||||
sleep(0.1)
|
||||
rand = random.randint(3, 7)
|
||||
sleep(rand)
|
||||
|
||||
|
||||
@app.task
|
||||
def monitor_agents_task() -> None:
|
||||
q = Agent.objects.only("pk", "version", "last_seen", "overdue_time")
|
||||
|
|
|
@ -29,10 +29,6 @@ app.conf.beat_schedule = {
|
|||
"task": "winupdate.tasks.check_agent_update_schedule_task",
|
||||
"schedule": crontab(minute=5, hour="*"),
|
||||
},
|
||||
"agents-checkinfull": {
|
||||
"task": "agents.tasks.check_in_task",
|
||||
"schedule": crontab(minute="*/24"),
|
||||
},
|
||||
"agent-auto-update": {
|
||||
"task": "agents.tasks.auto_self_agent_update_task",
|
||||
"schedule": crontab(minute=35, hour="*"),
|
||||
|
|
Loading…
Reference in New Issue