# (c) cavaliba.com - user/iam - tasks.py

from celery import shared_task

#from app_home.configuration import get_configuration
import app_home.cache as cache
from app_home.log import log, DEBUG


from app_user.group import group_autogroup_update

# @app.task
@shared_task(ignore_result=True)
def task_autogroup_update():

    # flush_cache_per_request()
    cache.init()

    aaa = None
    # count = run_monitors()
    # count = 0
    count = group_autogroup_update()
    log(DEBUG, aaa=aaa, app="iam", view="cron", action="autogroup_update", status="OK", data=f"{count} groups updated")
