From 2f82dc55d1daa21ee3b396e5295f35bb4f121a16 Mon Sep 17 00:00:00 2001 From: Pedro Brochado Date: Thu, 14 Nov 2024 03:53:56 -0300 Subject: [PATCH] Add uvloop as the the Gunicorn worker eventloop closes #6021 --- CHANGES/6021.feature | 1 + pulpcore/content/entrypoint.py | 7 ++++++- pyproject.toml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 CHANGES/6021.feature diff --git a/CHANGES/6021.feature b/CHANGES/6021.feature new file mode 100644 index 0000000000..a6de1cd4a0 --- /dev/null +++ b/CHANGES/6021.feature @@ -0,0 +1 @@ +Replaced async with uvloop as the Gunicorn worker eventloop. diff --git a/pulpcore/content/entrypoint.py b/pulpcore/content/entrypoint.py index 5ae79cfe22..7163297a25 100644 --- a/pulpcore/content/entrypoint.py +++ b/pulpcore/content/entrypoint.py @@ -5,7 +5,7 @@ class PulpcoreContentApplication(PulpcoreGunicornApplication): def load_app_specific_config(self): self.set_option("default_proc_name", "pulpcore-content", enforced=True) - self.set_option("worker_class", "aiohttp.GunicornWebWorker", enforced=True) + self.set_option("worker_class", "aiohttp.GunicornUVLoopWebWorker", enforced=True) def load(self): import pulpcore.content @@ -15,6 +15,11 @@ def load(self): @click.option("--bind", "-b", default="[::]:24816") @click.option("--workers", "-w", type=int) +@click.option( + "--worker-class", + "-k", + type=click.Choice(["aiohttp.GunicornWebWorker", "aiohttp.GunicornUVLoopWebWorker"]), +) # @click.option("--threads", "-w", type=int) # We don't use a threaded worker... @click.option("--name", "-n", "proc_name") @click.option("--timeout", "-t", type=int) diff --git a/pyproject.toml b/pyproject.toml index 32c287303a..89ae7395e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,6 +66,7 @@ dependencies = [ "tablib<3.6.0", "url-normalize>=1.4.3,<=1.4.3", "uuid6>=2023.5.2,<=2024.7.10", + "uvloop>=0.21.0,<0.22", "whitenoise>=5.0,<6.9.0", "yarl>=1.8,<1.17.3", ]