DmitryTsepelev / graphql-ruby-persisted_queries

Persisted queries for graphql-ruby
MIT License
171 stars 20 forks source link

Fix double hashing of keys in case of redis_with_local_cache_store adapter #62

Closed mpospelov closed 1 year ago

mpospelov commented 1 year ago

Hey @DmitryTsepelev 👋 Thank you for your great project 🚀

At our company we decided to switch to redis_with_local_cache_store store adapter but during performance testing we found significant drop.

After analyzing code of graphql-ruby-persisted_queries I found out that when we fetch or restore queries from storage we use #fetch_query and #save_query which expects unprocessed keys gathered from extensions.persistedQuery.sha256Hash. But in RedisWithLocalCacheStoreAdapter in #fetch the hash is already processed and it will be something like compiled:ruby-3.1.2:2.0.16:abc123 so when we run #fetch_query or #save_query it will be processed again to compiled:ruby-3.1.2:2.0.16:compiled:ruby-3.1.2:2.0.16:abc123, so follow-up calls to fetch query seems result in weird results.