Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix] Reduce theme upload batch size to prevent timeout #5113

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +29 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment here specifying where is the limit coming from? Or perhaps linking this very PR so the context is not lost?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I will add a comment explaining why we had to lower this limit.

export const MAX_UPLOAD_RETRY_COUNT = 2

export function uploadTheme(
Expand Down
Loading