populationgenomics / metamist

Sample level metadata system
MIT License
1 stars 1 forks source link

Workaround for graphql performance issue when using generic input types #836

Closed dancoates closed 2 weeks ago

dancoates commented 2 weeks ago

At the moment there is a issue with strawberry graphql which causes performance issues in cases where the field type for a large result set uses a generic input type. There is an outline of this issue here: https://github.com/strawberry-graphql/strawberry/issues/3544 and a stripped down reproduction case here https://github.com/dancoates/strawberry-generic-input-repro/blob/main/schema.py.

This PR introduces a workaround to this issue by making input types concrete before they are used in the GraphQL schema. This does introduce some code duplication, but IMO is worth it for the speed up, in my testing it has made requests 3-5x faster.

codecov-commenter commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.27%. Comparing base (7717ebe) to head (d41a483).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #836 +/- ## ========================================== + Coverage 79.17% 79.27% +0.10% ========================================== Files 161 161 Lines 13615 13684 +69 ========================================== + Hits 10779 10848 +69 Misses 2836 2836 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dancoates commented 2 weeks ago

Closing in favour of #841