From b7cf6f4edc569bc31b5a7fcdceffe65af1ee1a03 Mon Sep 17 00:00:00 2001 From: Yasen Date: Mon, 9 Feb 2026 13:38:53 +0100 Subject: [PATCH] Disable chunks for sync endpoint --- CHANGES/1305.feature | 1 + pulp-glue/src/pulp_glue/rpm/context.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 CHANGES/1305.feature diff --git a/CHANGES/1305.feature b/CHANGES/1305.feature new file mode 100644 index 000000000..d787c33e8 --- /dev/null +++ b/CHANGES/1305.feature @@ -0,0 +1 @@ +Disabling the chunk uploads to the synchronous rpm endpoint to improve performance. \ No newline at end of file diff --git a/pulp-glue/src/pulp_glue/rpm/context.py b/pulp-glue/src/pulp_glue/rpm/context.py index c838f80d2..653ee6053 100644 --- a/pulp-glue/src/pulp_glue/rpm/context.py +++ b/pulp-glue/src/pulp_glue/rpm/context.py @@ -178,12 +178,18 @@ def upload( size = os.path.getsize(file.name) body: dict[str, t.Any] = {**kwargs} + use_upload_endpoint = repository is None and self.pulp_ctx.has_plugin( + PluginRequirement("rpm", specifier=">=3.32.5") + ) + if not self.pulp_ctx.fake_mode: - if chunk_size > size: - # Small file: direct upload + # The "upload" endpoint always requires direct file upload (no chunking) + # The "create" endpoint supports chunked upload for large files + if use_upload_endpoint or chunk_size > size: + # Direct file upload: required for upload endpoint, or small files body["file"] = file else: - # Large file: chunked upload + # Large file with create endpoint: chunked upload if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.20.0")): from pulp_glue.core.context import PulpUploadContext @@ -195,11 +201,8 @@ def upload( artifact_href = PulpArtifactContext(self.pulp_ctx).upload(file, chunk_size) body["artifact"] = artifact_href - # For rpm plugin >= 3.32.5, use synchronous upload endpoint when no repository is provided - # For older versions, always use the create endpoint (backward compatibility) - if repository is None and self.pulp_ctx.has_plugin( - PluginRequirement("rpm", specifier=">=3.32.5") - ): + # Call the appropriate endpoint + if use_upload_endpoint: return self.call("upload", body=body) # Repository is specified or older rpm version: use create endpoint (async path)