Skip to content

Faster startup (2/4): Fire-and-forget hooks + process.exit(0)#7052

Draft
gonzaloriestra wants to merge 1 commit intofaster-startupfrom
faster-startup-2
Draft

Faster startup (2/4): Fire-and-forget hooks + process.exit(0)#7052
gonzaloriestra wants to merge 1 commit intofaster-startupfrom
faster-startup-2

Conversation

@gonzaloriestra
Copy link
Contributor

WHY are these changes introduced?

The CLI requires too much time to start working, it feels slow

WHAT is this pull request doing?

Runs the command first with exclusive CPU time, then fires prerun/postrun hooks as fire-and-forget after command completes. Calls process.exit(0) in bootstrap to avoid blocking on pending analytics/version-check network requests.

  • Fire-and-forget hooks in runCommand: after the command finishes, prerun + postrun hooks run asynchronously without blocking the user
  • process.exit(0) in bootstrap: forces exit after command completes so pending network I/O (analytics, upgrade checks) doesn't delay the prompt returning

Startup time: 570ms → 250ms (-56%)

How to test your changes?

  • shopify version / shopify help return correct output faster
  • shopify app dev still reports analytics (fire-and-forget, best-effort)
  • No regression in command behavior

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Made with Cursor

Copy link
Contributor Author

gonzaloriestra commented Mar 19, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Run the command first with exclusive CPU time, then fire prerun/postrun
hooks as fire-and-forget after command completes. Call process.exit(0)
in bootstrap to avoid blocking on pending analytics/version-check
network requests.

Startup time: 570ms → 250ms (-56%)

Made-with: Cursor
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.

1 participant