Skip to content

Use a named function for the middleware over an anonymous#827

Merged
abernix merged 2 commits into
apollographql:masterfrom
oliviertassinari:patch-2
Apr 18, 2018
Merged

Use a named function for the middleware over an anonymous#827
abernix merged 2 commits into
apollographql:masterfrom
oliviertassinari:patch-2

Conversation

@oliviertassinari

Copy link
Copy Markdown
Contributor

@abernix abernix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this!

}

return (req: express.Request, res: express.Response, next): void => {
return function graphql(req: express.Request, res: express.Response, next): void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to call this graphqlExpressHandler?

oliviertassinari and others added 2 commits April 17, 2018 22:59
It's making the investigation of performance issues easier.
As originally reported in [0], this should make debugging performance issues
easier, since the name of the function will be properly displayed/shown in
flame-graphs.

[0]: #827
@abernix abernix merged commit f8ca710 into apollographql:master Apr 18, 2018
@oliviertassinari oliviertassinari deleted the patch-2 branch April 18, 2018 07:48
@abernix

abernix commented Apr 18, 2018

Copy link
Copy Markdown
Member

I've gone ahead and extended this (in 7d7aceb) to be a consistent pattern across the various middleware variants (Express, Koa, etc.) and also included the GraphiQL middlewares too. Thanks for opening this originally!

@oliviertassinari

Copy link
Copy Markdown
Contributor Author

Thanks!

@abernix

abernix commented Apr 18, 2018

Copy link
Copy Markdown
Member

This should be published in 1.3.5. Please report back how it works!

ShiyamRajan pushed a commit to ShiyamRajan/apollo-server-lambda that referenced this pull request Nov 2, 2018
As originally reported in [0], this should make debugging performance issues
easier, since the name of the function will be properly displayed/shown in
flame-graphs.

[0]: apollographql/apollo-server#827
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants