Skip to content

Instantly share code, notes, and snippets.

@lucaspolo
Created October 23, 2021 02:12
Show Gist options
  • Save lucaspolo/6300cd862fd367eb92e242981a70d6a2 to your computer and use it in GitHub Desktop.
Save lucaspolo/6300cd862fd367eb92e242981a70d6a2 to your computer and use it in GitHub Desktop.
import os
import time
from celery import Celery
app = Celery('tasks', broker=os.getenv('BROKER_URL', 'redis://localhost/0'))
@app.task
def envia_email():
...
app.conf.beat_schedule = {
'envia-emails-a-cada-30-segundas': {
'task': 'tasks.envia_email',
'schedule': 10.0,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment