add optional delay to update check

This commit is contained in:
wh1te909 2020-02-02 07:32:02 +00:00
parent 4621dba3d3
commit b7575e31e0
2 changed files with 7 additions and 3 deletions

View File

@ -1,11 +1,15 @@
from time import sleep
from agents.models import Agent
from .models import WinUpdate
from tacticalrmm.celery import app
@app.task
def check_for_updates_task(pk):
def check_for_updates_task(pk, wait=False):
if wait:
sleep(60)
agent = Agent.objects.get(pk=pk)

View File

@ -25,7 +25,7 @@ def get_win_updates(request, pk):
@api_view()
def run_update_scan(request, pk):
agent = get_object_or_404(Agent, pk=pk)
check_for_updates_task.delay(agent.pk)
check_for_updates_task.delay(agent.pk, wait=False)
return Response("ok")