1

I want to add a long running job upon starting the server see below for my current implementation.

async def start_job():
    await long_job()

async def long_job():
    await task()
    await asyncio.sleep(settings.SLEEP)
      
app = Starlette(
        debug=settings.DEBUG, on_startup=[start_job]
    )

Its currently working but I'm not sure if its the right/correct way to do it any suggestions?

user799451
  • 81
  • 12

0 Answers0