-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(gatsby): close parcel cache db before clearing cache and retrying #36377
Conversation
Co-authored-by: Dan Kirkham <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Even after the upstream issue is fixed it's probably useful we have access to our own instantiated cache like this.
There are a couple new failures in the Windows tests after merging in the latest from master that seem legit (do we need to change any of the setup/teardown introduced in #36343?)
Windows tests: https://app.circleci.com/pipelines/github/gatsbyjs/gatsby/85107/workflows/e6e3213c-9150-4498-8686-f7ba94734b08/jobs/1019361
Description
Windows crashes hard when you try to move/delete files that are opened. In this case our typescript retry mechanism is causing to hit this issue because Parcel's cache remains alive.
This PR allow us to control the cache life, by passing cache instance explicitly instead of relying on the default. This allows us to close DB connection which removes open handle to db file and allow us to delete those files without errors
Please note that while working on this I discovered some issues with modules that throw on import time. There is runtime parcel require cache that seems to not throw anymore on consecutive imports of problematic modules - instead those are imported as empty objects. In practice it means that we might not show proper errors for this kind of problems, until it's resolved in Parcel
Related Issues
Fixes #36371