Skip to content

Instantly share code, notes, and snippets.

@lucaspolo
Created October 23, 2021 01:58
Show Gist options
  • Save lucaspolo/239b2ce2804208530f24b63c6dfc994c to your computer and use it in GitHub Desktop.
Save lucaspolo/239b2ce2804208530f24b63c6dfc994c 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():
lista_de_usuarios = [
'Monica',
'Cebolinha',
'Magali',
'Cascão',
'Louco',
'Tina',
'Rolo',
]
for usuario in lista_de_usuarios:
print(f'Enviando email para {usuario}...')
time.sleep(1)
print(f'Email enviando para {usuario}!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment