Skip to content

Commit

Permalink
Merge pull request #5113 from Shopify/bugfix/decrease-theme-upload-ba…
Browse files Browse the repository at this point in the history
…tch-size

[Bug Fix] Reduce theme upload batch size to prevent timeout
  • Loading branch information
jamesmengo authored Dec 18, 2024
2 parents 4e3ffcc + df9d347 commit ae29b61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-frogs-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/theme': minor
---

[Bug Fix] Reduce theme upload batch size to prevent timeout
14 changes: 11 additions & 3 deletions packages/theme/src/cli/utilities/theme-uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ae29b61

Please sign in to comment.