We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bad Semaphore initialization in RequestLimiter
**Describe the bug**
RequestLimiter takes a number as parameter and use it to set up a Semaphore. The issue is that the environment variable indicates the concurrent allowed requests per worker. When the semaphore is created (https://github.com/deepset-ai/haystack/blob/6790eaf7d8be05c5674d97a75cc5783e00a66875/rest_api/rest_api/controller/utils.py#L13), this value is set down by 1. This is clearly not what the project tried to achieve (at least per naming). 

**Error message**
REST API will always return it's busy, error 503 when CONCURRENT_REQUEST_PER_WORKER is equal to CONCURRENT_REQUEST_PER_WORKER -1. When user set the concurrency to 1, it will never be able to call the API, since the Semaphore declaration will be Semaphore(0)

**Expected behavior**
Being able to set the request limits using the env variable CONCURRENT_REQUEST_PER_WORKER

**Additional context**


**To Reproduce**


**FAQ Check**
- [x] Have you had a look at [our new FAQ page](https://haystack.deepset.ai/overview/faq)?

**System:**
 - OS: Ubuntu
 - GPU/CPU: i7/ Nvidia
 - Haystack version (commit or version number): 1.9
 - DocumentStore:
 - Reader:
 - Retriever:


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `rest_api/rest_api/controller/utils.py`
Content:
```
1 from typing import Type, NewType
2 
3 import inspect
4 from contextlib import contextmanager
5 from threading import Semaphore
6 
7 from fastapi import Form, HTTPException
8 from pydantic import BaseModel
9 
10 
11 class RequestLimiter:
12     def __init__(self, limit):
13         self.semaphore = Semaphore(limit - 1)
14 
15     @contextmanager
16     def run(self):
17         acquired = self.semaphore.acquire(blocking=False)
18         if not acquired:
19             raise HTTPException(status_code=503, detail="The server is busy processing requests.")
20         try:
21             yield acquired
22         finally:
23             self.semaphore.release()
24 
25 
26 StringId = NewType("StringId", str)
27 
28 
29 def as_form(cls: Type[BaseModel]):
30     """
31     Adds an as_form class method to decorated models. The as_form class method
32     can be used with FastAPI endpoints
33     """
34     new_params = [
35         inspect.Parameter(
36             field.alias,
37             inspect.Parameter.POSITIONAL_ONLY,
38             default=(Form(field.default) if not field.required else Form(...)),
39         )
40         for field in cls.__fields__.values()
41     ]
42 
43     async def _as_form(**data):
44         return cls(**data)
45 
46     sig = inspect.signature(_as_form)
47     sig = sig.replace(parameters=new_params)
48     _as_form.__signature__ = sig  # type: ignore
49     setattr(cls, "as_form", _as_form)
50     return cls
51
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/rest_api/rest_api/controller/utils.py b/rest_api/rest_api/controller/utils.py
--- a/rest_api/rest_api/controller/utils.py
+++ b/rest_api/rest_api/controller/utils.py
@@ -10,7 +10,7 @@
 
 class RequestLimiter:
     def __init__(self, limit):
-        self.semaphore = Semaphore(limit - 1)
+        self.semaphore = Semaphore(limit)
 
     @contextmanager
     def run(self):

{"golden_diff": "diff --git a/rest_api/rest_api/controller/utils.py b/rest_api/rest_api/controller/utils.py\n--- a/rest_api/rest_api/controller/utils.py\n+++ b/rest_api/rest_api/controller/utils.py\n@@ -10,7 +10,7 @@\n \n class RequestLimiter:\n     def __init__(self, limit):\n-        self.semaphore = Semaphore(limit - 1)\n+        self.semaphore = Semaphore(limit)\n \n     @contextmanager\n     def run(self):\n", "issue": "Bad Semaphore initialization in RequestLimiter\n**Describe the bug**\r\nRequestLimiter takes a number as parameter and use it to set up a Semaphore. The issue is that the environment variable indicates the concurrent allowed requests per worker. When the semaphore is created (https://github.com/deepset-ai/haystack/blob/6790eaf7d8be05c5674d97a75cc5783e00a66875/rest_api/rest_api/controller/utils.py#L13), this value is set down by 1. This is clearly not what the project tried to achieve (at least per naming). \r\n\r\n**Error message**\r\nREST API will always return it's busy, error 503 when CONCURRENT_REQUEST_PER_WORKER is equal to CONCURRENT_REQUEST_PER_WORKER -1. When user set the concurrency to 1, it will never be able to call the API, since the Semaphore declaration will be Semaphore(0)\r\n\r\n**Expected behavior**\r\nBeing able to set the request limits using the env variable CONCURRENT_REQUEST_PER_WORKER\r\n\r\n**Additional context**\r\n\r\n\r\n**To Reproduce**\r\n\r\n\r\n**FAQ Check**\r\n- [x] Have you had a look at [our new FAQ page](https://haystack.deepset.ai/overview/faq)?\r\n\r\n**System:**\r\n - OS: Ubuntu\r\n - GPU/CPU: i7/ Nvidia\r\n - Haystack version (commit or version number): 1.9\r\n - DocumentStore:\r\n - Reader:\r\n - Retriever:\r\n\n", "before_files": [{"content": "from typing import Type, NewType\n\nimport inspect\nfrom contextlib import contextmanager\nfrom threading import Semaphore\n\nfrom fastapi import Form, HTTPException\nfrom pydantic import BaseModel\n\n\nclass RequestLimiter:\n    def __init__(self, limit):\n        self.semaphore = Semaphore(limit - 1)\n\n    @contextmanager\n    def run(self):\n        acquired = self.semaphore.acquire(blocking=False)\n        if not acquired:\n            raise HTTPException(status_code=503, detail=\"The server is busy processing requests.\")\n        try:\n            yield acquired\n        finally:\n            self.semaphore.release()\n\n\nStringId = NewType(\"StringId\", str)\n\n\ndef as_form(cls: Type[BaseModel]):\n    \"\"\"\n    Adds an as_form class method to decorated models. The as_form class method\n    can be used with FastAPI endpoints\n    \"\"\"\n    new_params = [\n        inspect.Parameter(\n            field.alias,\n            inspect.Parameter.POSITIONAL_ONLY,\n            default=(Form(field.default) if not field.required else Form(...)),\n        )\n        for field in cls.__fields__.values()\n    ]\n\n    async def _as_form(**data):\n        return cls(**data)\n\n    sig = inspect.signature(_as_form)\n    sig = sig.replace(parameters=new_params)\n    _as_form.__signature__ = sig  # type: ignore\n    setattr(cls, \"as_form\", _as_form)\n    return cls\n", "path": "rest_api/rest_api/controller/utils.py"}], "after_files": [{"content": "from typing import Type, NewType\n\nimport inspect\nfrom contextlib import contextmanager\nfrom threading import Semaphore\n\nfrom fastapi import Form, HTTPException\nfrom pydantic import BaseModel\n\n\nclass RequestLimiter:\n    def __init__(self, limit):\n        self.semaphore = Semaphore(limit)\n\n    @contextmanager\n    def run(self):\n        acquired = self.semaphore.acquire(blocking=False)\n        if not acquired:\n            raise HTTPException(status_code=503, detail=\"The server is busy processing requests.\")\n        try:\n            yield acquired\n        finally:\n            self.semaphore.release()\n\n\nStringId = NewType(\"StringId\", str)\n\n\ndef as_form(cls: Type[BaseModel]):\n    \"\"\"\n    Adds an as_form class method to decorated models. The as_form class method\n    can be used with FastAPI endpoints\n    \"\"\"\n    new_params = [\n        inspect.Parameter(\n            field.alias,\n            inspect.Parameter.POSITIONAL_ONLY,\n            default=(Form(field.default) if not field.required else Form(...)),\n        )\n        for field in cls.__fields__.values()\n    ]\n\n    async def _as_form(**data):\n        return cls(**data)\n\n    sig = inspect.signature(_as_form)\n    sig = sig.replace(parameters=new_params)\n    _as_form.__signature__ = sig  # type: ignore\n    setattr(cls, \"as_form\", _as_form)\n    return cls\n", "path": "rest_api/rest_api/controller/utils.py"}]}