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

Update Haste Map to support unix epoch Clock spec #10286

Closed
majames opened this issue Jul 17, 2020 · 3 comments
Closed

Update Haste Map to support unix epoch Clock spec #10286

majames opened this issue Jul 17, 2020 · 3 comments

Comments

@majames
Copy link

majames commented Jul 17, 2020

🚀 Feature Proposal

Context

As previously mentioned, we use jest-haste-map at Airbnb (both directly and indirectly through the Metro bundler). Developers currently run Metro in a docker container as part of their development environment. This container is cycled frequently as part of their development workflow.

We can preserve the previously computed Haste Map file in a docker volume for re-use between cycles, however this doesn't help with subsequent Haste Map build performance as the previously stored logical clock is tied to a specific instance of Watchman (which changes on each container cycle). isFresh will always be true on container cycle which results in all files in the Haste Map being re-processed even if none of them have changed between cycles!

Suggested Solution

To workaround this issue, we could instead use a simple unix timestamp for determining which files to surface in the Watchman query. Using unix timestamps with since can suffer from race conditions, however given that the jest-haste-map only issues the query on build() (i.e. container boot in our use-case) there's next to no chance of this happening.

Implementation

jest-haste-map consumers could opt-in to this behavior by passing the clockType: 'unix-timestamp' option into the HasteMap constructor and, when said argument is provided it would override response.clock below this line with a unix timestamp.

Motivation

Allow haste maps to be re-used between container cycles increasing performance!

Example

We would update our internal fork of Metro to pass clockType: 'unix-timestamp' to the Haste Map constructor.

Pitch

It belongs in Jest core because it directly effects the jest-haste-map package.

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant