Description
I have a specific usecase where schemas are not static, but should be updated over time without entire app restart.
In short, I have a master express server (that handles task-specific routing for SaaS system), that spawns child apollo-express servers (each for corresponding subsystem), that each use complex schemas built with graphql-binding
over underlying microservices.
When something in subsystem's microservices updates I nee to rebuild it's schema. So I delete from memory corresponding apollo-express server and it is rebuilding (and new graphql-bindings are generated).
After each rebuild a manually call garbage collector. As of bindings do exist only in context of apollo-express server, deleting this server should terminate all references to graphql-bindings and GC should free memory of them.
But I encounter a problem with graphql-bindings method cache — it is not cleared when bindeings are deleted. After every update method cache grows and grows:
- It shouldn't act like this in general, method cache should be bound to concrete
Binding
instance to be cleared, when this instance is deleted - As for now, is there a way to manually clear method cache?
UPD
As I see from here https://github.com/graphql-binding/graphql-binding/blob/master/src/Binding.ts - no, there is no access to this cache map :(
Using such global static and unreachable cache is a design flaw, IMO