Repository navigation
Conversation
nikwen
left a comment
There was a problem hiding this comment.
This would be a breaking change. It would need to be called out as such in the docs. And we would need a migration path.
That said, I'm not sure there's consensus on where the cache data should be stored, so I'd hold off on implementing the above until we have consensus.
There's also a real cost of potentially thousands of wasted hours of Electron application developers' time as they make sure their app still works with this breaking change. I'm not sure this correctness change warrants all this developer time that could be spent solving more urgent problems for the world.
| // On Windows, there's no OS-level centralized location for caches, so | ||
| // store the cache in the app data directory. | ||
| int parent_key = base::DIR_ROAMING_APP_DATA; | ||
| int parent_key = base::DIR_LOCAL_APP_DATA; |
There was a problem hiding this comment.
What's the logic behind this? IIRC, local app data is where the app itself gets installed by Squirrel. Why would the cache live there? IMO it would make much more sense to keep it in roaming app data where it currently is.
There was a problem hiding this comment.
AppData, aka Roaming, as the name implies, is for files that can roam between computers, storing there gigabytes of cache from all electron apps doesn't make sense. Doesn't matter for me personally, but I think that's the right location.
There was a problem hiding this comment.
Understood. I see why it would make sense to store in local app data now.
The challenge is not having it collide with any existing files that might be placed in this directory (which is hard with thousands of Electron apps in the wild and some of them probably doing weird stuff). We'd definitely need to make sure nothing collides with popular installers such as Squirrel.
|
What the migration path should be? This issue is already held off for 10 years. Chromium on Linux already stores Cache and Code Cache in .cache, if Windows path is unclear, I may skip changing it. I'm not even sure why this would be a breaking change. Cache is not supposed to be precious data anyway, I may delete cache in all my electron apps and they'll still work, so there shouldn't be an issue in simply changing where it's stored, except for the old cache remaining where it is. |
Moving any existing files from the old location to the new location, probably before any developer-provided JS code is ever run.
In theory, that is correct. However, Electron is used in thousands of applications on billions of devices. Slack on my computer has 1.2G in its cache. Multiply that by 10 Electron apps per device on billions of devices and we'd leave old data lying around at the scale of exabytes (10^18 bytes). That's A LOT of data. We definitely need to clean that up. Also, with so many developers using Electron, some of them are guaranteed to be doing weird/non-standard stuff. We cannot just break things for them. When making changes to a framework that's used by so many different people, we need to be very conservative and make sure that we don't break anything for anyone. If an app relies on the assumption that cache is stored where it is stored (because it has been stored in that location for 10 years), we shouldn't break that without giving them the ability to make sure that their code still works. That's also why we need to document all breaking changes in the Nothing is more annoying as a developer than using a library that just changes its behavior all the time and introduces breaking changes. I hate that as a developer because it means I end up wasting lots and lots of time just on maintenance changes. That time could be better spent working on my app. |
|
Heads up: Windows CI builds moved to new runners on Monday and the old ones have now been removed. This branch predates that, so its Windows build jobs still point at the old runners and will sit queued forever if CI runs again. Rebasing on |
Description of Change
Using the work of #34337
Fixes #8124
Caches are now stored in LOCALAPPDATA and DIR_USER_CACHE instead of APPDATA and DIR_USER_DATA.
As APPDATA and XDG_CONFIG_HOME are supposed to be synced between devices or backed up to cloud, it is bad to store cache there, which can inflate the directories to gigabytes in size when there are multiple Electron apps.
TODO:
GPUCache?Checklist
npm testpassesRelease Notes
Notes: Cache is now stored in proper locations.