openproject
openproject copied to clipboard
Avoid SystemStackError on project eager loading wrapper
Ticket
https://community.openproject.org/wp/63498
What are you trying to accomplish?
Avoid SystemStackError when fetching a larger list of projects via the API v3. The problem arises when having 1000 projects in the system (could also happen sooner) and fetching those via the API by specifying pageSize=1000.
For all of the projects, the ancestors are prefetched for efficient rendering in the representer.
Before, this was done by constructing an AREL object that had a structure like this:
Grouping
OR
Grouping
OR
So a grouping and an OR was added for every project to the statement.
This crashed but using a similar approach with AR does not seem to be affected by the same problem. This was tested for 2000 projects which ran through without problems.