title: Run same coroutine periodically with aiohttp and aiojobs
body: <p>I have a manager to cache some user settings. I want to cleanup it  every hour for inactive users (10 seconds in my example). I try to use aiojobs for this. I spawn the same job inside the job coroutine.</p>
  
  <pre><code>from aiohttp import web
  from aiojobs.aiohttp import setup, get_scheduler
  import asyncio
  
  async def cleanup(scheduler):
      await asyncio.sleep(10)
      print('do cleanup')
      await scheduler.spawn(cleanup(scheduler))
  
  async def handler(request):
      if not request.app['init']:
          scheduler = get_scheduler(request)
          await scheduler.spawn(cleanup(scheduler))
          request.app['init'] = True
      return web.Response(text = 'ok')
  
  def main():
      app = web.Application()
      app.router.add_get('/', handler)
      setup(app)
      app['init'] = False
  
      web.run_app(app, host='127.0.0.1', port = 8000)
  
  main()
  </code></pre>
  
  <p>Is it a good solution? Should I create my own scheduler because my job does not relate to a request?</p>