perf: faster gzip compression (#33014)

Same as https://github.com/frappe/press/pull/2400
This commit is contained in:
Ankush Menat 2025-06-19 18:22:58 +05:30 committed by GitHub
parent 4fbdaf3a9b
commit 02d72d2bbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -242,7 +242,7 @@ def create_json_gz_file(data, dt, dn, report_name):
frappe.scrub(report_name), frappe.utils.data.format_datetime(frappe.utils.now(), "Y-m-d-H-M")
)
encoded_content = frappe.safe_encode(frappe.as_json(data, indent=None, separators=(",", ":")))
compressed_content = gzip.compress(encoded_content)
compressed_content = gzip.compress(encoded_content, compresslevel=5)
# Call save() file function to upload and attach the file
_file = frappe.get_doc(

View file

@ -306,7 +306,7 @@ def read_multi_pdf(output) -> bytes:
@deprecated("frappe.gzip_compress", "unknown", "v17", "Use py3 methods directly (this was compat for py2).")
def gzip_compress(data, compresslevel=9):
def gzip_compress(data, compresslevel=5):
"""Compress data in one shot and return the compressed string.
Optional argument is the compression level, in range of 0-9.
"""