Skip to content

Add a GraphQL resolver to get a project's pipeline counts by scopes and source

In !74605 (merged), we have implemented a Vue app that polls for a project's on-demand scan counts every second. The request currently relies on a single GraphQL transaction that triggers an SQL query for each requested scope (all, running and finished). In order to reduce the load on the database, let's implement a dedicated resolver that will:

  • Get the whole pipeline list in a single SQL query.
  • Count the pipelines for each requested scope by looping through the list.
  • Limit the counts to 1000 entries (!75372 (comment 751144288)).

Once the resolver is implemented, we should:

  • Leverage it in ee/app/helpers/projects/on_demand_scans_helper.rb to get all counts from a SSoT.

Related discussions:

Edited by Paul Gascou-Vaillancourt