Cache browsers locally instead of globally#106
Merged
Conversation
calebeby
commented
Jun 14, 2021
Comment on lines
88
to
93
| // I acknowledge that this code is gross and should be refactored | ||
| // Constraints: | ||
| // - If there is no browser in the config, multiple concurrent processes should only start 1 new browser | ||
| // - If there is a killed browser in the config, multiple concurrent processes should only start 1 new browser | ||
| // - If there "starting" in the config but nothing is really starting, multiple concurrent processes should only start 1 new browser | ||
| // - If there is no browser in the cache, multiple concurrent processes should only start 1 new browser | ||
| // - If there is a killed browser in the cache, multiple concurrent processes should only start 1 new browser | ||
| // - If there "starting" in the cache but nothing is really starting, multiple concurrent processes should only start 1 new browser | ||
| // TODO: Idea: use a state machine!!! |
Member
Author
There was a problem hiding this comment.
This code is still pretty gross, but it has held together way better than I expected. I'm leaving this comment here because I would still like to come back and rewrite it, but for the time being it works and is pretty resilient and "robust enough".
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const readConfig = async (configPath: string) => { | ||
| const readCache = async (cachePath: string) => { |
Member
Author
There was a problem hiding this comment.
Renamed all the things config -> cache because cache is more descriptive of what it actually is. I think at one point I had planned to put other stuff than browser cache URL's in that file, but not anymore.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77
Now the browser instance cache file is stored in the pleasantest folder rather than globally (previously it was
/Users/<user>/Library/Application\ Support/pleasantest-nodejs/config.json. Now it is stored as a sibling to thedistfolder.This solves several problems:
npm ci, they will get fresh browsers