Skip to content

Commit

Permalink
Add debounce to the status observers to reduce unnecessary CPU loops
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Aug 17, 2021
1 parent 94f3508 commit 89243dc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/server/status/plugins_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class PluginsStatusService {

public getDerivedStatus$(plugin: PluginName): Observable<ServiceStatus> {
return this.update$.pipe(
debounceTime(25),
switchMap(() => {
// Only go up the dependency tree if any of this plugin's dependencies have a custom status
// Helps eliminate memory overhead of creating thousands of Observables unnecessarily.
Expand Down Expand Up @@ -103,6 +104,7 @@ export class PluginsStatusService {
}

return this.update$.pipe(
debounceTime(25),
switchMap(() => {
const pluginStatuses = plugins
.map((depName) => {
Expand Down

0 comments on commit 89243dc

Please sign in to comment.