docs: def init_scheduler(db_uri):
      """Initialise and configure the scheduler."""
      global scheduler
      scheduler = apscheduler.Scheduler()
      scheduler.misfire_grace_time = 3600
      scheduler.add_jobstore(
          sqlalchemy_store.SQLAlchemyJobStore(url=db_uri), 'default')
      scheduler.add_listener(
          job_listener,
          events.EVENT_JOB_EXECUTED | events.EVENT_JOB_MISSED
          | events.EVENT_JOB_ERROR)
      return scheduler