openkfw / TruBudget

A blockchain-based workflow tool for efficient and transparent project management
https://openkfw.github.io/trubudget-website/
GNU General Public License v3.0
85 stars 39 forks source link

API: Cache global permissions #1836

Closed SamuelPull closed 4 months ago

SamuelPull commented 4 months ago

Description 😯

sourceGlobalPermissions in api is a major bottleneck (to the point of unusability) when a number of permission events get moderately large. Execution time increases linearly with the array length passed to for..of loop. Asymptotic running time is not the real issue, but rather that it processes all of this data repeatedly, even if it is not changed.

Permission events from which data is sourced are already cached.

Caching globalPerms.permissions object is expected to result in a large performance improvement.

Affected APIs: /network.list /network.listActive /global.listPermissions

How to reproduce 🕹

  1. <E.g. login as user XYZ>
  2. <E.g. try to create new subproject>
  3. <E.g. You will see error in console>
  4. ...

Screenshots 📷

Add screenshots or screen recording video if applicable.

Your Environment 🌎

Tech Version
Frontend v2.?.?
API v2.?.?
Blockchain v2.?.?
Export-Service v2.?.?
Email-Service v2.?.?
Storage-Service v2.?.?