Skip to content

Instantly share code, notes, and snippets.

@bilalozdemir
Created June 30, 2021 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bilalozdemir/3c0866d0de2cc5c7a3101fb652c8a424 to your computer and use it in GitHub Desktop.
Save bilalozdemir/3c0866d0de2cc5c7a3101fb652c8a424 to your computer and use it in GitHub Desktop.
Task Queue Subexample
@app.task(
name='send-email-to-user',
default_retry_delay=300,
max_retry=5,
soft_time_limit=30
)
def send_email_to_user(
user_email: str,
email_template: str,
extra_info: dict
):
_message = replace_fields_with_values(email_template, extra_info)
_sent = send_email(user_email, _message)
logging.info(f"Sent {email_template} email to user <{user_email}>")
return {
"email": user_email,
"email_type": email_template,
"email_status": _sent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment