Private
Public Access
1
0

redis monitor for CP update jobs

Stores job id in a cookie. Upon reload, checks if job is still busy. If
busy, no new jobs are started. Some messaging for users to give them
information about the job status.
This commit is contained in:
Sander Roosendaal
2017-10-27 11:52:47 +02:00
parent c0f785ed3b
commit 6b793724ed
5 changed files with 125 additions and 14 deletions

View File

@@ -473,9 +473,11 @@ def updatecpdata_sql(rower_id,delta,cp,table='cpdata',distance=[]):
engine.dispose()
def runcpupdate(rower,type='water'):
startdate = timezone.now()-datetime.timedelta(days=365)
enddate = timezone.now()+datetime.timedelta(days=5)
def runcpupdate(
rower,type='water',
startdate=timezone.now()-datetime.timedelta(days=365),
enddate=timezone.now()+datetime.timedelta(days=5)
):
if type == 'water':
theworkouts = Workout.objects.filter(
user=rower,rankingpiece=True,
@@ -499,11 +501,12 @@ def runcpupdate(rower,type='water'):
theids = [w.id for w in theworkouts]
if settings.DEBUG:
res = handle_updatecp.delay(rower.id,theids,debug=True,table=table)
job = handle_updatecp.delay(rower.id,theids,debug=True,table=table)
else:
res = queue.enqueue(handle_updatecp,rower.id,theids,table=table)
job = queue.enqueue(handle_updatecp,rower.id,theids,table=table)
return job
def fetchcperg(rower,theworkouts):
theids = [int(w.id) for w in theworkouts]