Bug: plugin registration might be unintentionally shared between two GraphQL server instances
The reason for this bug is that in raphtory-graphql we use a static variable called PLUGIN_ALGOS inside server.rs to first add plugins in and then extracting them to register them in the graphql schema. The reason for following that approach is that the way that dynamic-graphql gives us to register types that are dynamically defined is defining the Register trait. We implement that trait for a struct that acts as a collection of algorithms, called Algorithms. The point is, that function is static, and therefore there is no other way for us to access the plugins defined by the user than accessing some global context as we do with the static variable. This is not ideal, and should be fixed if posible.
The solution might be using the async-graphql::dynamic API to access the registry and register the type ourselves. Then, even if we don't register the types in the implementation of Register for Algorithms, when the algorithms are called in we downcast to the type of the user defined algorithm, it should be found in the registry and work properly.
I have a suspicion that either async-graphql or dynamic-graphql are already using static variables to get these things working though, so maybe by doing this we are just relying on those libraries to do exactly the same thing underneath and there is no point of doing this.
UPDATE: an easier solution for this could be simply make APIs more clear. Having a global function that you cal to register plugins so that it does not seem like you are registering it for a particular server, as we currently do.