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 theme dev session #927

Merged
merged 9 commits into from
Dec 19, 2022
Merged

Fix theme dev session #927

merged 9 commits into from
Dec 19, 2022

Conversation

isaacroldan
Copy link
Contributor

WHY are these changes introduced?

theme dev needs a valid session at all times, so we need to take care of refreshing the tokens before they expire.
A bug was introduced where the 90min interval was causing theme dev to just stop instead of properly refresh the session.

Fixes #781

WHAT is this pull request doing?

  • Remove promises from inside the setInterval function, as it doesn't play well with awaits (but we don't need them)
  • Add a sleep call to keep the server running for up to 24h
  • Add some defensive code so that the ruby process termination can't propagate the termination to the node process.

How to test your changes?

  • theme dev for at least 2h, the session should be refreshed automatically and the server restarted.

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

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "yarn changeset add" to track your changes and include them in the next release CHANGELOG.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 14, 2022

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
68.1% (-0.12% 🔻)
3563/5232
🟡 Branches
62.5% (+0.07% 🔼)
1150/1840
🟡 Functions
66.18% (-0.07% 🔻)
902/1363
🟡 Lines
68.27% (-0.1% 🔻)
3387/4961
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / content-tokens.ts
44.44% (-3.7% 🔻)
20% (-10% 🔻)
47.37%
44.44% (-3.7% 🔻)
🔴
... / system.ts
42.55% (-6.16% 🔻)
36.36% (-5.74% 🔻)
33.33% (-3.03% 🔻)
44.44% (-4.27% 🔻)
🔴
... / common.ts
58.33% (-4.63% 🔻)
50% (-4.55% 🔻)
87.5%
56.52% (-5.02% 🔻)

Test suite run success

872 tests passing in 441 suites.

Report generated by 🧪jest coverage report action from e912857

@pepicrft
Copy link
Contributor

@isaacroldan did this end up working?

@isaacroldan
Copy link
Contributor Author

Yes and no, it refreshes the tokens and starts a new ruby process. But on windows it fails to terminate old processes, so you end up with multiple theme dev servers running at the same time.
Still need to dedicate some time to figure it out, probably early next week.

options?.signal?.addEventListener('abort', () => {
commandProcess.kill('SIGTERM', {forceKillAfterTimeout: 1000})
const pid = commandProcess.pid
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious, after this fix, do we still need to treat windows differently here? It might be the case that now we can just kill the tree correctly with the previous code on windows as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to remove the windowsHide property?

@isaacroldan isaacroldan merged commit 495fa62 into main Dec 19, 2022
@isaacroldan isaacroldan deleted the fix-theme-dev-session branch December 19, 2022 10:08
@shopify-shipit shopify-shipit bot temporarily deployed to production December 22, 2022 11:12 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.

[Bug]: shopify theme dev stops after an hour and a half
4 participants