From 3aa2307f74e217d8a5e1efe5f52805e2045d8493 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 --- pulpcore/content/entrypoint.py | 7 ++++++- pyproject.toml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pulpcore/content/entrypoint.py b/pulpcore/content/entrypoint.py index 5ae79cfe221..7163297a256 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 32c287303ad..89ae7395e86 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", ]