From 1f0508f1a7f7eded904d983fd51d687d75b6660b Mon Sep 17 00:00:00 2001 From: Alok Swamy Date: Mon, 16 Dec 2024 18:55:13 +0530 Subject: [PATCH] Reduce theme upload batch size to prevent timeout --- .changeset/heavy-frogs-pretend.md | 5 +++++ packages/theme/src/cli/utilities/theme-uploader.ts | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changeset/heavy-frogs-pretend.md diff --git a/.changeset/heavy-frogs-pretend.md b/.changeset/heavy-frogs-pretend.md new file mode 100644 index 00000000000..4b25e284671 --- /dev/null +++ b/.changeset/heavy-frogs-pretend.md @@ -0,0 +1,5 @@ +--- +'@shopify/theme': minor +--- + +[Bug Fix] Reduce theme upload batch size to prevent timeout diff --git a/packages/theme/src/cli/utilities/theme-uploader.ts b/packages/theme/src/cli/utilities/theme-uploader.ts index e98f977efe0..1069696561f 100644 --- a/packages/theme/src/cli/utilities/theme-uploader.ts +++ b/packages/theme/src/cli/utilities/theme-uploader.ts @@ -17,10 +17,18 @@ interface UploadOptions { type ChecksumWithSize = Checksum & {size: number} type FileBatch = ChecksumWithSize[] +/** + * Even though the API itself can handle a higher batch size, we limit the batch file count + bytesize + * to avoid timeout issues happening on the theme access proxy level. + * + * The higher the batch size, the longer the proxy request lasts. We should also generally avoid long running + * queries against our API (i.e. over 30 seconds). There is no specific reason for these values, but were + * previously used against the AssetController. + */ // Limits for Bulk Requests -export const MAX_BATCH_FILE_COUNT = 50 -// 10MB -export const MAX_BATCH_BYTESIZE = 1024 * 1024 * 10 +export const MAX_BATCH_FILE_COUNT = 20 +// 1MB +export const MAX_BATCH_BYTESIZE = 1024 * 1024 export const MAX_UPLOAD_RETRY_COUNT = 2 export function uploadTheme(