-
Notifications
You must be signed in to change notification settings - Fork 702
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
Only watch resources that are updated in UX. #3902
Conversation
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
@@ -39,7 +39,7 @@ export const requestResources = createAction("REQUEST_RESOURCES", resolve => { | |||
watch: boolean, | |||
handler: (r: GetResourcesResponse) => void, | |||
onError: (e: Event) => void, | |||
onComplete: (pkg: InstalledPackageReference) => void, | |||
onComplete: () => void, |
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.
There was no need for the arg since it can be included via closure.
return () => {}; | ||
} | ||
|
||
const parsedRefs = parseResources(app.apiResourceRefs); | ||
setAppViewResourceRefs(parsedRefs); | ||
return () => {}; | ||
}, [app, cluster, kinds, appViewResourceRefs]); | ||
}, [app?.apiResourceRefs]); |
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.
Just cleaned up the dependencies (ie. we don't want to fire this effect whenever the app changes, only when the resource refs change).
Awesome! From 40 to 13 watches :) |
Signed-off-by: Michael Nelson minelson@vmware.com
Description of the change
Rather than watching all resources for an installed package (as Kubeapps has done for quite some time), this PR updates so that we only watch the resources which are updated in the UX and just fetch the rest once only when the AppView is mounted.
Benefits
Viewing Kubeapps, for example, now results in only 13 watches on the k8s API server (from the plugin), rather than ~40.
Possible drawbacks
Applicable issues
Additional information