muffin icon indicating copy to clipboard operation
muffin copied to clipboard

@app.task descriptor not working

Open mr-mogul opened this issue 2 years ago • 0 comments

Describe the bug run_after_response example does not work. AttributeError: 'Application' object has no attribute 'task'

To Reproduce Steps to reproduce the behavior:

from muffin import Application

app = Application()

@app.task
def send_email(email, message):
# send email here
pass

@app.route('/send')
async def send(request):

# Schedule any awaitable for later execution
app.run_after_response(send_email('[email protected]', 'Hello from Muffin!'))

# Return response to a client immediately
# The task will be executed after the response is sent
return "OK"

Desktop (please complete the following information): muffin 0.100.1

mr-mogul avatar Dec 07 '23 18:12 mr-mogul