-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cache browsers locally instead of globally #106
Conversation
// 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!!! |
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.
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".
|
||
const readConfig = async (configPath: string) => { | ||
const readCache = async (cachePath: string) => { |
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.
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.
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.
LGTM 👍
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 thedist
folder.This solves several problems:
npm ci
, they will get fresh browsers