Skip to content

LPA Dashboard Speedup pt 2 #1608

Description

@pooleycodes

In dashboard speedup pt 1, fetchEntityIssueCounts was identified as a performance bottleneck. This was resolved by switching to the endpoint_dataset_issue_type_summary table in the performance database. Initially, this appeared to work correctly with issues displaying properly on the dashboard.

However, during testing, it was discovered that Salford showed an incorrect issue count for the trees dataset. Further investigation revealed the root cause:

  1. A separate function, fetchEntryIssueCounts, runs a slow LEFT JOIN SQL operation on the issue table
  2. The results from fetchEntryIssueCounts are merged with fetchEntityIssueCounts into a single array
  3. Another function counts the number of rows for each unique dataset to calculate the task numbers displayed on the dashboard

The switch to the performance database for fetchEntityIssueCounts inadvertently caused issue count duplication whenever fetchEntryIssueCounts returns results. This bug went undetected because the issue table returns no results for most LPAs. Why Salford is the only LPA returning data from the issue table requires further investigation.

Solution: Remove fetchEntryIssueCounts from the middleware chain and fetchEntryCounts (Separate function with no use). This change:

  • Further improves dashboard performance
  • Eliminates the duplication bug
  • Provides clearer insight into the middleware chain's operations

Future improvement: The internal pipeline could be used instead of the performance database for even better performance.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Done - This Period

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions