add optional delay to update check
This commit is contained in:
parent
4621dba3d3
commit
b7575e31e0
|
@ -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)
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue