code: async def create_pool(settings: RedisSettings = None, *, _retry: int = 0) -> ArqRedis:
      
      settings = settings or RedisSettings()
      addr = settings.host, settings.port
      try:
          pool = await aioredis.create_redis_pool(
              addr,
              db=settings.database,
              password=settings.password,
              timeout=settings.conn_timeout,
              encoding='utf8',
              commands_factory=ArqRedis,
          )
      except (ConnectionError, OSError, aioredis.RedisError, asyncio.TimeoutError) as e:
          if _retry < settings.conn_retries:
              logger.warning(
                  'redis connection error %s:%s %s %s, %d retries remaining...',
                  settings.host,
                  settings.port,
                  e.__class__.__name__,
                  e,
                  settings.conn_retries - _retry,
              )
              await asyncio.sleep(settings.conn_retry_delay)
          else:
              raise
      else:
          if _retry > 0:
              logger.info('redis connection successful')
          return pool
  
      # recursively attempt to create the pool outside the except block to avoid
      # "During handling of the above exception..." madness
      return await create_pool(settings, _retry=_retry + 1)
docs: Create a new redis pool, retrying up to ``conn_retries`` times if the connection fails.
  
      Similar to ``aioredis.create_redis_pool`` except it returns a :class:`arq.connections.ArqRedis` instance,
      thus allowing job enqueuing.