Skip to content

Ab#132322 improve back end performance#1235

Open
GhaziAlibi wants to merge 3 commits into
nextfrom
AB#132322-improve-back-end-performance
Open

Ab#132322 improve back end performance#1235
GhaziAlibi wants to merge 3 commits into
nextfrom
AB#132322-improve-back-end-performance

Conversation

@GhaziAlibi
Copy link
Copy Markdown
Contributor

Description

  • all.ts: run style filters in parallel; remove dead cursor-pagination branch; group _relatedRecords filters by (entity, field) with $in instead of one $or per item; add .lean() on the related-records lookup.
  • all.ts: cache computed permissionFilters per user alongside ability (5-min TTL).
  • recordsAggregation: batch ReferenceData lookups into a single find({_id:{$in}}) before the sourceFields loop; skip the
    related-forms Form.aggregate when no sourceField requires it.
  • setDisplayText: parallelize the field-choice resolution with Promise.all and add a per-call Resource cache.
  • cache: introduce shared @utils/cache module (single ioredis client + BaseRedisCache singleton + JSON-namespaced createCache helper); reuse it from getNextId, dataSources and the new permissionFiltersCache.

Type of change

Please delete options that are not relevant.

  • Improvement (refactor or addition to existing functionality)

How Has This Been Tested?

  • Manual: records grid (all.ts) — On HEMS-TEST, open a dashboard with a heavy grid widget. Verify:
    • Records load and pagination (skip/first) work.
    • Style rules (color/badge) apply correctly to the matching rows.
    • Row actions visibility (action filters) is unchanged.
    • Related-record columns (resource/resources fields) display the expected values.
  • Manual: recordsAggregation (charts) — On EIS, open a dashboard with chart widgets that use recordsAggregation. Verify:
    • Charts render with the same categories/values as before.
    • ReferenceData-backed fields still display correctly.
    • Aggregations referencing related-form fields still work (regression check for the conditional Form.aggregate skip).
  • Manual: permissions — Log in as a non-admin user, load a grid, verify only authorized records are returned (covers both permission-filters cache miss and hit).

Checklist:

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant — N/A, back-end only
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required ) — no public API change
  • I have added tests that prove my fix is effective or that my feature works — perf change, validated by before/after measurements
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream module

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants