Skip to content

Commit afa4fe8

Browse files
committed
fix: remove artifact.file.close() that causes seek-of-closed-file error
The explicit close() on main_artifact.file broke the fallback path in _process_metadata_batch, which calls artifact_to_metadata_artifact() for the final batch — that function calls artifact.file.seek(0) on the already-closed handle. Removing the close is safe: the file handle is released when the batch flushes and references are cleared. The temp file cleanup (os.unlink) still happens immediately. JIRA: PULP-1573
1 parent a92fa57 commit afa4fe8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

pulp_python/app/tasks/repair.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ def repair_metadata(content: QuerySet[PythonPackageContent]) -> tuple[int, set[s
142142
package, new_data, batch, set_of_update_fields
143143
)
144144

145-
# Clean up temp file and close artifact file handle
145+
# Clean up temp file after processing
146146
if temp_path and os.path.exists(temp_path):
147147
os.unlink(temp_path)
148-
main_artifact.file.close()
149148

150149
# For on-demand content, we expect that:
151150
# 1. PythonPackageContent always has correct name and version

0 commit comments

Comments
 (0)