slowness due to the betaseries step, moving to shared task
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.db.models import Count
|
||||
from django.core.exceptions import MultipleObjectsReturned
|
||||
from celery.worker.state import active_requests
|
||||
from celery import shared_task
|
||||
from requests.compat import str
|
||||
from apps.betaserie.utils import betaserieUtils
|
||||
from .models import simpsons_data_object
|
||||
@@ -9,11 +10,16 @@ betaserie = betaserieUtils()
|
||||
|
||||
simpsons_id = 12
|
||||
|
||||
def mark_episode_watched(season,episode,action):
|
||||
|
||||
print("season_number: "+str(season))
|
||||
print("episode_number: "+str(episode))
|
||||
|
||||
@shared_task()
|
||||
def mark_episode_watched(season,episode,action,verbose=False):
|
||||
#mark episode as seen in DB
|
||||
simpsons_data_object.filter(season=season, episode=episode).values('seen').update(seen=True)
|
||||
|
||||
|
||||
if verbose : print("season_number: "+str(season))
|
||||
if verbose : print("episode_number: "+str(episode))
|
||||
|
||||
#mark episode as seen in betaserie
|
||||
episode_number = "S"+str(season)+"E"+str(episode)
|
||||
|
||||
episode_id = betaserie.identify_episode(simpsons_id,episode_number)
|
||||
|
||||
Reference in New Issue
Block a user