Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving setting userinfo from request-listener to exception-listener #37

Closed
wants to merge 1 commit into from

Conversation

tdel
Copy link

@tdel tdel commented Jan 2, 2017

Use case :

  • using AuthorizationChecker::isGranted() trigger a query (I know, it shouldn't but some devs are doing wrong things sometimes...)
  • triggering a query means "hello doctrine" and fetching the result of that query
  • lost severals milliseconds because of that.

In fact, this is done on each request but it should only be done when an exception arise.

This PR move some codes where it should be handled properly.

@dcramer
Copy link
Member

dcramer commented Jan 2, 2017

This regresses behavior in which calling out to capture any kind of handled exception would no longer have the current user set. The goal of context is that you can bind it (albeit, I agree, lazily would be nicer), and then any future events generated within a transaction contain that context. Now it's only doing it after one of two kinds of events happen.

@Jean85
Copy link
Collaborator

Jean85 commented Mar 3, 2017

I'm sorry, but I completely disagree on this.

If, as an example, the exception being thrown is somewhat DB-related, the query may not be executable, and this will fail.

Also, if any user is logged in, the query for the user will be executed anyway for each request, so you're just doing it early, you will not save any time for your request.

@Jean85 Jean85 closed this May 5, 2017
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.

None yet

3 participants