Private
Public Access
1
0

alternative approach

This commit is contained in:
Sander Roosendaal
2017-11-01 22:38:01 +01:00
parent 4c7afecc55
commit 053a6df7b9
4 changed files with 56 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ redis_connection = StrictRedis()
import redis
import threading
import requests
from django.conf import settings
def getvalue(data):
perc = 0
@@ -55,4 +57,23 @@ def longtask(aantal,jobid=None,debug=False,
return 1
def longtask2(aantal,jobid=None,debug=False):
counter = 0
channel = 'tasks'
for i in range(aantal):
time.sleep(1)
counter += 1
if counter > 10:
counter = 0
if debug:
progress = int(100.*i/aantal)
if jobid != None:
url = settings.SITE_URL+"/rowers/record-progress/"
url += str(progress)+"/"+jobid
s = requests.get(url)
return 1