You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
The datasource classes have some subtitles or pitfalls that I think could be more clearly documented. Interested in thoughts from the maintainers on this point
By my understanding, all data access objects should be initialised during server initialisation and added to the datasources section of the context when initialising the ApolloServer object. All of the docs very clearly show this. I think it would be very dangerous for someone to make an incorrect assumption about where the datasources (especially database connections/connection pools) should be initialised.
If someone makes an incorrect assumption about how the datasource classes work and add their connection initialisation to the actual implementation of the Datasource class, they could have a very bad time. In this case, they are creating and potentially not tearing down connections on each request to the server which may have negative consequences to whatever backend database they are using. This could easily lead to a denial-of-service
If my assumption about this potential consequence and the reason ALL of the examples show initialising data access objects at server start time are correct, then I would like to propose an amendment to the docs to provide a brief explanation of when/how to setup data access objects.
If there is another reason why data access is always shown in the docs to be initialised at server startup, then it may be worth clarifying those points in the documentation.
The text was updated successfully, but these errors were encountered:
The datasource classes have some subtitles or pitfalls that I think could be more clearly documented. Interested in thoughts from the maintainers on this point
By my understanding, all data access objects should be initialised during server initialisation and added to the datasources section of the context when initialising the ApolloServer object. All of the docs very clearly show this. I think it would be very dangerous for someone to make an incorrect assumption about where the datasources (especially database connections/connection pools) should be initialised.
If someone makes an incorrect assumption about how the datasource classes work and add their connection initialisation to the actual implementation of the Datasource class, they could have a very bad time. In this case, they are creating and potentially not tearing down connections on each request to the server which may have negative consequences to whatever backend database they are using. This could easily lead to a denial-of-service
If my assumption about this potential consequence and the reason ALL of the examples show initialising data access objects at server start time are correct, then I would like to propose an amendment to the docs to provide a brief explanation of when/how to setup data access objects.
If there is another reason why data access is always shown in the docs to be initialised at server startup, then it may be worth clarifying those points in the documentation.
The text was updated successfully, but these errors were encountered: