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

Allow setOptions() to set runtime port #610

Merged
merged 5 commits into from
Jun 19, 2023

Conversation

GregBrimble
Copy link
Member

No idea if this is even vaguely right, but here's a first stab at fixing #608.

@changeset-bot
Copy link

changeset-bot bot commented Jun 18, 2023

⚠️ No Changeset found

Latest commit: 03663fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mrbbot
Copy link
Contributor

mrbbot commented Jun 19, 2023

I think this should work, but I'd prefer we use the same Runtime instance across reloads. Could we add an entryPort option to updateConfig()...

...then set this here based on runtimeEntryURL.port if !initial?

const maybePort = await this.#runtime.updateConfig(configBuffer, {
signal: this.#disposeController.signal,
});

We'd need to extract args construction out of the Runtime constructor() and into a separate method too.

packages/miniflare/src/runtime/index.ts Outdated Show resolved Hide resolved
packages/miniflare/src/runtime/index.ts Outdated Show resolved Hide resolved
packages/miniflare/src/index.ts Outdated Show resolved Hide resolved
packages/miniflare/src/index.ts Outdated Show resolved Hide resolved
Comment on lines +785 to +786
async #assembleAndUpdateConfig() {
const initial = !this.#runtimeEntryURL;
Copy link
Member Author

Choose a reason for hiding this comment

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

Tidied this up while I was here. But lemme know if you want me to pull that change out :)

Copy link
Contributor

@mrbbot mrbbot left a comment

Choose a reason for hiding this comment

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

One tiny thing, then looks good to me! ✅

packages/miniflare/src/runtime/index.ts Outdated Show resolved Hide resolved
@GregBrimble GregBrimble force-pushed the fix-set-options-port-0 branch from e890a43 to 03663fc Compare June 19, 2023 11:01
@mrbbot
Copy link
Contributor

mrbbot commented Jun 19, 2023

CI seems a little borked, but I don't think it's related to this PR. Merging this now, and will investigate today 👍

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