shreemaan-abhishek opened a new pull request, #13809: URL: https://github.com/apache/apisix/pull/13809
### Description `graphql-limit-count` computes a query's selection-nesting depth (used as the rate-limit cost) by expanding fragment spreads in place. The cycle guard (`visited`) was cleared after each descent, so a fragment referenced from more than one place was fully re-measured on every occurrence. When fragments reference other fragments repeatedly, the depth computation grows exponentially in the number of fragments, so a small document can become expensive to process in the access phase. This memoizes each fragment's resolved depth so a fragment is measured once regardless of how many times it is spread. `visited` still guards fragment cycles; a new `memo` table caches the per-fragment result, keeping the traversal linear in the document size. The computed depth is unchanged for existing queries. Added tests: a route whose query reuses fragments many times now returns normally instead of stalling the worker. #### Which issue(s) this PR fixes: <!-- private --> ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [ ] I have updated the documentation to reflect this change - [x] I have verified that this change is backward compatible -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
