mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-26 04:33:09 +08:00
Update the celery task comment and name (#720)
This commit is contained in:
@ -1,12 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from anyio import sleep
|
||||
from time import sleep
|
||||
|
||||
from anyio import sleep as asleep
|
||||
|
||||
from backend.app.task.celery import celery_app
|
||||
|
||||
|
||||
@celery_app.task(name='task_demo')
|
||||
def task_demo() -> str:
|
||||
"""示例任务,模拟耗时操作"""
|
||||
sleep(20)
|
||||
return 'test async'
|
||||
|
||||
|
||||
@celery_app.task(name='task_demo_async')
|
||||
async def task_demo_async() -> str:
|
||||
"""异步示例任务,模拟耗时操作"""
|
||||
await sleep(20)
|
||||
await asleep(20)
|
||||
return 'test async'
|
||||
|
Reference in New Issue
Block a user