cloudfoundry / cloudfoundry/stratos

Metrics actions that rely on a time window will dispatch the same action with a stale time window

Open
#3,668 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
267
Forks
137
Avg merge
5h 14m
Merged PRs (30d)
77

Description

To fix this we could do something similar to CfAppAutoscalerEventsDataSource (currently avoided due to updated ctor leading to wide scale change, alternatively could make helper function required a static)

src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts

  private getRefreshFunction(config: IListDataSourceConfig<A, T>) {
    if (config.listConfig && config.listConfig.hideRefresh) {
      return null;
    }
    return config.refresh ? config.refresh : () => {
      if (Array.isArray(this.action)) {
        this.action.forEach(action => this.store.dispatch(action));
      } else {
        // Metrics actions that rely on a time window will dispatch the same action with a stale time window. To fix this we could do
        // something similar to CfAppAutoscalerEventsDataSource (currently avoided due to updated ctor leading to wide scale change,
        // alternatively could make helper function required a static)
        this.store.dispatch(this.metricsAction || this.masterAction);
      }
    };
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/frontend/packages/core/src/shared/components/list/data-sources-controllers/list-data-source.ts, focusing on getRefreshFunction and how metricsAction and masterAction are constructed. Compare the approach with CfAppAutoscalerEventsDataSource and trace the affected metrics refresh path. Done means a refresh dispatches a current time-window action rather than reusing a stale one, without requiring a broad constructor change.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.