mirror of https://github.com/rancher/dashboard.git
Remove resources from the store if they meet certain criteria. This will reduce the memory footprint of the dashboard and load on the backend (less watchers for large collections)
- GC is disabled by default and can be enabled via the Global Settings --> Performance tab
- User can configure
- The age in milliseconds in which a resource has to exceed in order to be gc'd
- The count which a resource has to exceed in order to be gc'd
- GC occures in stores that have it enabled
- ATM this is just the `cluster` store... but could be enabled for dashboard-store's such as the harvester one (one liner plus optional `gcIgnoreTypes` override for ignoring types)
- GC will be kicked off in two cases
- Route Change for a logged in state
- At a given interval
- Resource type _not_ GC'd if
- The store is ignoring the type
- For example the `cluster` store doesn't want to gc things like `schema` and `count`
- We're going to a page for that resource (list, detail, etc)
- For example don't GC pods if we're going to a pods page
- The last time the resource was accessed was recently
- We store the resource accessed time via hooking into actions and getters
- Setting the last accessed time will cause watchers of that type to trigger (only an issue for duplicate watchers)... but importantly not watchers of other types
- The resource is being used in the current page/context
- We store the route changed time and compare it to the resource accessed time
- There's too few resources
- We might as well keep them to avoid a network request to re-populate
// TODO:
- Should additional features be added to preferences
- if GC on route change is enabled
- if GC on interval is enabled, and how often it runs
- Sensible default preferences
- Remove some logging
|
||
|---|---|---|
| .. | ||
| authenticated.js | ||
| i18n.js | ||
| unauthenticated.js | ||