Sanic use --workers run, Multiple add tasks do

I use --workers=4 run sanic , use app.add_task(do()) run a scheduled do task, because it’s set --workers=4, so 4 do() concurrent execution,but i want one do() execution, What should I do?

Where do you want it? In only the main process? In only one of the workers?

Take a look at @app.main_process_start and see if that suits your needs.

Thank you. Let me try.