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

[Miniflare 3] Avoid using temporary directory if possible #720

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Oct 20, 2023

Miniflare 2 persisted data in-memory between setOptions() calls when *Persist options were disabled. Whilst workerd has in-memory storage for Durable Objects, this is reset when workerd is restarted (i.e. when setOptions() is called). To retain Miniflare 2 behaviour in Miniflare 3, we actually persist to a temporary directory when *Persist options are disabled. There are cases where we don't need the temporary directory though: if we have no storage bindings configured, cache is false, and unsafeEphemeralDurableObjects is true. This change ensures we don't write to the temporary directory in these cases.

Ref: cloudflare/workers-sdk#4167

Miniflare 2 persisted data in-memory between `setOptions()` calls when
`*Persist` options were disabled. Whilst `workerd` has in-memory
storage for Durable Objects, this is reset when `workerd` is
restarted (i.e. when `setOptions()` is called). To retain Miniflare 2
behaviour in Miniflare 3, we actually persist to a temporary directory
when `*Persist` options are disabled. There are cases where we don't
need the temporary directory though: if we have no storage bindings
configured, `cache` is `false`, and `unsafeEphemeralDurableObjects` is
`true`. This change ensures we don't write to the temporary directory
in these cases.
@mrbbot mrbbot requested a review from a team October 20, 2023 10:44
@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2023

⚠️ No Changeset found

Latest commit: 30ac489

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 mrbbot merged commit a37ede3 into tre Oct 24, 2023
9 checks passed
@mrbbot mrbbot deleted the bcoll/dont-use-tmp-dir branch October 24, 2023 09:48
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