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

Reuse Docker container between reloads, closes #369 #376

Merged
merged 3 commits into from
Sep 18, 2022
Merged

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Sep 14, 2022

Instead of creating a new container whenever we change the config, we now start a single container with a custom entrypoint script. On receiving SIGUSR1, this script restarts the runtime process. This change reduces reload time from ~1.5s to ~400ms on my machine.

On my machine, this change reduces reload time from ~1.5s to ~400ms
@mrbbot mrbbot requested a review from penalosa September 14, 2022 13:16
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 14, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7da20b6
Status: ✅  Deploy successful!
Preview URL: https://1759449a.cf-miniflare.pages.dev
Branch Preview URL: https://tre-reuse-docker.cf-miniflare.pages.dev

View logs

packages/tre/src/index.ts Show resolved Hide resolved
packages/tre/src/runtime/index.ts Show resolved Hide resolved
packages/tre/src/runtime/index.ts Show resolved Hide resolved
packages/tre/src/runtime/index.ts Outdated Show resolved Hide resolved

function waitForExit(process: childProcess.ChildProcess): Promise<number> {
function waitForExit(process: childProcess.ChildProcess): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change from void to number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows us to return #processExitPromise directly from dispose() without an await. We weren't actually using the exit code anywhere, though perhaps we should be logging it if verbose is enabled?

@mrbbot mrbbot merged commit b929f02 into tre Sep 18, 2022
@mrbbot mrbbot deleted the tre-reuse-docker branch September 18, 2022 14:45
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