Implement queue
This commit is contained in:
parent
1d2cbf8135
commit
3824fdabc7
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@ from .device import makewificonfig, heartbeathandler
|
||||||
from .tasks import mkfirmware
|
from .tasks import mkfirmware
|
||||||
|
|
||||||
from distutils.dir_util import copy_tree
|
from distutils.dir_util import copy_tree
|
||||||
|
from celery.exceptions import TimeoutError
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
|
@ -72,7 +73,10 @@ def update(request):
|
||||||
|
|
||||||
device = get_object_or_404(Device, secret=request.POST.get("secret", ""))
|
device = get_object_or_404(Device, secret=request.POST.get("secret", ""))
|
||||||
|
|
||||||
if not mkfirmware(device, FWDIR):
|
try:
|
||||||
|
if not mkfirmware.delay(device, FWDIR).get(timeout=300):
|
||||||
|
return HttpResponse(status=503)
|
||||||
|
except TimeoutError:
|
||||||
return HttpResponse(status=503)
|
return HttpResponse(status=503)
|
||||||
|
|
||||||
sigUpdateDevice(device.serial, None, False)
|
sigUpdateDevice(device.serial, None, False)
|
||||||
|
|
Loading…
Reference in a new issue