I am getting the task in scheduler-e Sanic:

from apscheduler.schedulers.asyncio import AsyncIOScheduler @app.listener('before_server_start') async def initialize_scheduler(app, loop): scheduler = AsyncIOScheduler() scheduler.add_job(example_function, 'interval', seconds=20, max_instances=1, coalesce=True) scheduler.start() 

and run the application with 17 workers

The problem is that in the end, every 20 seconds, the function example_function is called by all 17 workers in asynchronous mode.

Question: how to make so, scheduler was executed by only one worker?

Thank!

    0