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

Fix concurrent function builds #2911

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Sep 29, 2023

WHY are these changes introduced?

Fixes #2877

We are building the functions in parallel and when the javy-cli binary is not present, all of them will try to download and run it at the same time, causing an error sometimes.

WHAT is this pull request doing?

When the deploy includes functions, pre-download the javy binary (by running a simple javy command, which automatically downloads it when it's not present) to avoid issues when running build concurrently, which might cause multiple downloads in parallel.

Alternatives:

  • Do not build functions in parallel when there are several
  • Try to make javy more robust by preventing multiple processes from downloading/accessing the binary simultaneously

How to test your changes?

  • Generate 3+ functions (more likely to crash)
  • Remove the javy binary, so that it has to be downloaded again: rm ~/Library/Caches/binarycache/javy*
  • p shopify app deploy

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@github-actions
Copy link
Contributor

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/theme-code-tools
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/cli-foundations

@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 73.32% 6035/8231
🟡 Branches 69.86% 2941/4210
🟡 Functions 72.27% 1543/2135
🟡 Lines 74.69% 5725/7665

Test suite run success

1433 tests passing in 670 suites.

Report generated by 🧪jest coverage report action from de8104d

@gonzaloriestra gonzaloriestra requested review from a team, isaacroldan and amcaplan and removed request for a team October 3, 2023 11:58
@gonzaloriestra gonzaloriestra marked this pull request as ready for review October 5, 2023 08:38
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/common/version.d.ts
@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "3.49.1";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "3.49.5";
\ No newline at end of file
packages/cli-kit/dist/public/node/error-handler.d.ts
@@ -14,11 +14,9 @@ export declare function errorHandler(error: Error & {
 export declare function sendErrorToBugsnag(error: unknown): Promise<{
     reported: false;
     error: unknown;
-    unhandled: unknown;
 } | {
     error: Error;
     reported: true;
-    unhandled: boolean;
 }>;
 /**
  * If the given file path is within a node_modules folder, remove prefix up
packages/cli-kit/dist/public/node/error.d.ts
@@ -74,7 +74,7 @@ export declare function handler(error: unknown): Promise<unknown>;
  */
 export declare function errorMapper(error: unknown): Promise<unknown>;
 /**
- * A function that checks if an error should be reported as unhandled.
+ * A function that checks if an error should be reported.
  *
  * @param error - Error to be checked.
  * @returns A boolean indicating if the error should be reported.
packages/cli-kit/dist/public/node/monorail.d.ts
@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
 import { DeepRequired } from '../common/ts/deep-required.js';
 export { DeepRequired };
 type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC: "app_cli3_command/1.9";
+export declare const MONORAIL_COMMAND_TOPIC: "app_cli3_command/1.7";
 export interface Schemas {
     [MONORAIL_COMMAND_TOPIC]: {
         sensitive: {
@@ -60,9 +60,6 @@ export interface Schemas {
             cmd_dev_tunnel_type?: Optional<string>;
             cmd_dev_tunnel_custom_hash?: Optional<string>;
             cmd_dev_urls_updated?: Optional<boolean>;
-            cmd_dev_preview_url_opened?: Optional<boolean>;
-            cmd_dev_graphiql_opened?: Optional<boolean>;
-            cmd_dev_dev_preview_toggle_used?: Optional<boolean>;
             cmd_create_app_template?: Optional<string>;
             cmd_create_app_template_url?: Optional<string>;
             cmd_deploy_flag_message_used?: Optional<boolean>;
packages/cli-kit/dist/public/node/ui.d.ts
@@ -30,7 +30,7 @@ export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps
  * 00:00:00 │ frontend │ third frontend message
  *
  */
-export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<void>;
+export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<void | void[]>;
 export type AlertCustomSection = CustomSection;
 export type RenderAlertOptions = Omit<AlertOptions, 'type'>;
 /**
packages/cli-kit/dist/private/node/testing/ui.d.ts
@@ -10,16 +10,14 @@ declare class Stderr extends EventEmitter {
 }
 export declare class Stdin extends EventEmitter {
     isTTY: boolean;
-    data: string | null;
     constructor(options?: {
         isTTY?: boolean;
     });
     write: (data: string) => void;
     setEncoding(): void;
     setRawMode(): void;
-    ref(): void;
-    unref(): void;
-    read: () => string | null;
+    resume(): void;
+    pause(): void;
 }
 interface Instance {
     rerender: (tree: ReactElement) => void;
packages/cli-kit/dist/public/node/testing/ui.d.ts
@@ -1 +1 @@
-export { getLastFrameAfterUnmount, render, Stdin, waitForInputsToBeReady, waitForContent, sendInputAndWait, sendInputAndWaitForChange, sendInputAndWaitForContent, } from '../../../private/node/testing/ui.js';
\ No newline at end of file
+export { getLastFrameAfterUnmount, render, Stdin, waitForInputsToBeReady, waitForContent, } from '../../../private/node/testing/ui.js';
\ No newline at end of file

@gonzaloriestra gonzaloriestra merged commit 280b4f7 into stable/3.49 Oct 5, 2023
2 checks passed
@gonzaloriestra gonzaloriestra deleted the fix-concurrent-function-builds branch October 5, 2023 10:38
@shopify-shipit shopify-shipit bot temporarily deployed to stable_3_49 October 5, 2023 13:39 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants