from celery.task.schedules import crontab
from celery.decorators import periodic_task, task

import random
import structlog

from .emails import send_feedback_email

log = structlog.get_logger('testlogger')

#@periodic_task(
#    run_every=(crontab(minute=0, hour=0)),
#    name="send_feedback_email_task",
#    ignore_result=True
#)
def send_feedback_email_task():
    """sends an email when feedback form is filled successfully"""
    log.msg("Task: send email to an admin")
    send_feedback_email()

count = 0
@task(name="count_number_of_run")
def count_number_of_run():
    global count
    count = count + 1
    log.msg(f"inside count_number_of_run {count}")
    #for x in range(random.randint(1, 10)):
        #log.msg(f"inside count_number_of_run {count}")
        #count_number_of_run.apply_async()




