besu
besu copied to clipboard
Allow `maxActiveConnections` for GraphQL and terminate requests based on actual connection status
PR description
- The option of
--graphql-http-max-active-connectionshas been added to limit the numer of GraphQL requests served each time. - The GraphQL server has been relying on an
isAliveHandlerto terminate requests based on the timeout. However, this handler was only applied tomatchingLogs, resulting in unterminated GraphQL executions in general even if the connection has timed out. Rather than relying on a future task, it is more appropriate to terminate requests based on the actual status of the connection. TheTimeoutHandlershould have handled the HTTP timeout while connections may also be terminated due to exceedingmaxActiveConnections.
Docs change would be added in another PR in a later stage when code changes stabilise.
Fixed Issue(s)
- [ ] I thought about documentation and added the
doc-change-requiredlabel to this PR if updates are required. - [ ] I thought about the changelog and included a changelog update if required.
- [ ] If my PR includes database changes (e.g. KeyValueSegmentIdentifier) I have thought about compatibility and performed forwards and backwards compatibility tests
There is also a refactoring of the GraphQL tests to a base class with all server start and end methods.
Quite a number of methods common to all HTTP services (CORS checking, Hostlist checking etc.) were relocated to reuse code.
A parent class HttpConfiguration has been created. Are there suggestions to a better name?
@macfarla @shemnon I am now implementing only changes for max connections and timeout. The rest is to be implemented later.