prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  --limit-max-requests not working
  Hi! I'm trying to figure out why my workers are not restarting as expected when using the `--limit-max-requests` flag. I ran `uvicorn` in debug mode and noticed that the `self.server_state.total_requests` count is not increasing (stays at 0 after each request) so `self.server_state.total_requests >= self.config.limit_max_requests` never returns `True`. 
  When looking into where the `total_requests` was used, I noticed that the `protocols.http.[auto/h11/httptools]` were never getting called. I tried forcing the `--http h11` and `--http httptools` parameters, without any change in behavior. Any help would be appreciated!
  
  </issue>
  <code>
  [start of uvicorn/workers.py]
  1 import asyncio
  2 
  3 from gunicorn.workers.base import Worker
  4 
  5 from uvicorn.config import Config
  6 from uvicorn.main import Server
  7 
  8 
  9 class UvicornWorker(Worker):
  10     """
  11     A worker class for Gunicorn that interfaces with an ASGI consumer callable,
  12     rather than a WSGI callable.
  13     """
  14 
  15     CONFIG_KWARGS = {"loop": "uvloop", "http": "httptools"}
  16 
  17     def __init__(self, *args, **kwargs):
  18         super(UvicornWorker, self).__init__(*args, **kwargs)
  19 
  20         self.log.level = self.log.loglevel
  21 
  22         config_kwargs = {
  23             "app": None,
  24             "logger": self.log,
  25             "timeout_keep_alive": self.cfg.keepalive,
  26             "timeout_notify": self.timeout,
  27             "callback_notify": self.callback_notify,
  28         }
  29 
  30         if self.cfg.is_ssl:
  31             ssl_kwargs = {
  32                 "ssl_keyfile": self.cfg.ssl_options.get("keyfile"),
  33                 "ssl_certfile": self.cfg.ssl_options.get("certfile"),
  34                 "ssl_version": self.cfg.ssl_options.get("ssl_version"),
  35                 "ssl_cert_reqs": self.cfg.ssl_options.get("cert_reqs"),
  36                 "ssl_ca_certs": self.cfg.ssl_options.get("ca_certs"),
  37                 "ssl_ciphers": self.cfg.ssl_options.get("ciphers"),
  38             }
  39             config_kwargs.update(ssl_kwargs)
  40 
  41         config_kwargs.update(self.CONFIG_KWARGS)
  42 
  43         self.config = Config(**config_kwargs)
  44 
  45     def init_process(self):
  46         self.config.setup_event_loop()
  47         super(UvicornWorker, self).init_process()
  48 
  49     def init_signals(self):
  50         pass
  51 
  52     def run(self):
  53         self.config.app = self.wsgi
  54         server = Server(config=self.config)
  55         loop = asyncio.get_event_loop()
  56         loop.run_until_complete(
  57             server.serve(sockets=self.sockets, shutdown_servers=False)
  58         )
  59 
  60     async def callback_notify(self):
  61         self.notify()
  62 
  63 
  64 class UvicornH11Worker(UvicornWorker):
  65     CONFIG_KWARGS = {"loop": "asyncio", "http": "h11"}
  66
  [end of uvicorn/workers.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/uvicorn/workers.py b/uvicorn/workers.py
  --- a/uvicorn/workers.py
  +++ b/uvicorn/workers.py
  @@ -25,6 +25,7 @@
               "timeout_keep_alive": self.cfg.keepalive,
               "timeout_notify": self.timeout,
               "callback_notify": self.callback_notify,
  +            "limit_max_requests": self.max_requests,
           }
   
           if self.cfg.is_ssl:
  
verification_info: {"golden_diff": "diff --git a/uvicorn/workers.py b/uvicorn/workers.py\n--- a/uvicorn/workers.py\n+++ b/uvicorn/workers.py\n@@ -25,6 +25,7 @@\n             \"timeout_keep_alive\": self.cfg.keepalive,\n             \"timeout_notify\": self.timeout,\n             \"callback_notify\": self.callback_notify,\n+            \"limit_max_requests\": self.max_requests,\n         }\n \n         if self.cfg.is_ssl:\n", "issue": "--limit-max-requests not working\nHi! I'm trying to figure out why my workers are not restarting as expected when using the `--limit-max-requests` flag. I ran `uvicorn` in debug mode and noticed that the `self.server_state.total_requests` count is not increasing (stays at 0 after each request) so `self.server_state.total_requests >= self.config.limit_max_requests` never returns `True`. \r\nWhen looking into where the `total_requests` was used, I noticed that the `protocols.http.[auto/h11/httptools]` were never getting called. I tried forcing the `--http h11` and `--http httptools` parameters, without any change in behavior. Any help would be appreciated!\n", "before_files": [{"content": "import asyncio\n\nfrom gunicorn.workers.base import Worker\n\nfrom uvicorn.config import Config\nfrom uvicorn.main import Server\n\n\nclass UvicornWorker(Worker):\n    \"\"\"\n    A worker class for Gunicorn that interfaces with an ASGI consumer callable,\n    rather than a WSGI callable.\n    \"\"\"\n\n    CONFIG_KWARGS = {\"loop\": \"uvloop\", \"http\": \"httptools\"}\n\n    def __init__(self, *args, **kwargs):\n        super(UvicornWorker, self).__init__(*args, **kwargs)\n\n        self.log.level = self.log.loglevel\n\n        config_kwargs = {\n            \"app\": None,\n            \"logger\": self.log,\n            \"timeout_keep_alive\": self.cfg.keepalive,\n            \"timeout_notify\": self.timeout,\n            \"callback_notify\": self.callback_notify,\n        }\n\n        if self.cfg.is_ssl:\n            ssl_kwargs = {\n                \"ssl_keyfile\": self.cfg.ssl_options.get(\"keyfile\"),\n                \"ssl_certfile\": self.cfg.ssl_options.get(\"certfile\"),\n                \"ssl_version\": self.cfg.ssl_options.get(\"ssl_version\"),\n                \"ssl_cert_reqs\": self.cfg.ssl_options.get(\"cert_reqs\"),\n                \"ssl_ca_certs\": self.cfg.ssl_options.get(\"ca_certs\"),\n                \"ssl_ciphers\": self.cfg.ssl_options.get(\"ciphers\"),\n            }\n            config_kwargs.update(ssl_kwargs)\n\n        config_kwargs.update(self.CONFIG_KWARGS)\n\n        self.config = Config(**config_kwargs)\n\n    def init_process(self):\n        self.config.setup_event_loop()\n        super(UvicornWorker, self).init_process()\n\n    def init_signals(self):\n        pass\n\n    def run(self):\n        self.config.app = self.wsgi\n        server = Server(config=self.config)\n        loop = asyncio.get_event_loop()\n        loop.run_until_complete(\n            server.serve(sockets=self.sockets, shutdown_servers=False)\n        )\n\n    async def callback_notify(self):\n        self.notify()\n\n\nclass UvicornH11Worker(UvicornWorker):\n    CONFIG_KWARGS = {\"loop\": \"asyncio\", \"http\": \"h11\"}\n", "path": "uvicorn/workers.py"}]}