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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user