Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gmethvin
Copy link
Member

As far as I can tell, ApplicationProvider#get is not meant to be called multiple times for the same request. It looks like that was the case previously, but in 2.6.x we've added some caching based on the Try[Application] instance and are calling the ApplicationProvider to get the current instance each time. The current dev mode reload logic forces a reload next time (forceReloadNextTime = true) when compilation fails, so if get is called more than once for a single request, that causes multiple compilations per request.

My solution here proposes to get the Try[Application] once and pass that instance around for the handling of the request.

Fixes #7753

@richdougherty
Copy link
Member

Also fixes #7650 - thanks! I can review this tomorrow if you like.

@gmethvin
Copy link
Member Author

👍 A review would be great. I'm not totally happy with the way the code is structured now so I wonder if you have ideas on how to do it more elegantly.

Copy link
Member

@richdougherty richdougherty left a comment

Choose a reason for hiding this comment

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

LGTM - I have lots of ideas for changing how the whole request pipeline works (see #8005), but this looks like a good incremental step.

Copy link
Member

@richdougherty richdougherty left a comment

Choose a reason for hiding this comment

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

(Meant to approve in last review)

@gmethvin gmethvin changed the title [WIP] Avoid multiple calls to ApplicationProvider#get for a single request Avoid multiple calls to ApplicationProvider#get for a single request Jan 17, 2018
@gmethvin gmethvin merged commit 6ede001 into playframework:master Jan 17, 2018
@gmethvin gmethvin deleted the try-app branch January 17, 2018 21:34
gmethvin added a commit to gmethvin/playframework that referenced this pull request Jan 17, 2018
gmethvin added a commit to gmethvin/playframework that referenced this pull request Jan 18, 2018
gmethvin added a commit to gmethvin/playframework that referenced this pull request Jan 18, 2018
gmethvin added a commit to gmethvin/playframework that referenced this pull request Jan 24, 2018
@TimMoore TimMoore added this to the Play 2.7.0 milestone Dec 10, 2018
@mkurz
Copy link
Member

mkurz commented Aug 27, 2019

Regarding the comment above:

Also fixes #7650 - thanks! I can review this tomorrow if you like.

I guess we can close #7650 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile error triggers multiple compilations

4 participants