🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@derrabus
Copy link
Contributor

In order to implement symfony/symfony#18244 properly, I needed the ability to reset a Twig profile.

@stof
Copy link
Member

stof commented Sep 25, 2017

Does resetting the Profile object actually work fine ? This object is the data object serialized by the TwigDataCollector in lateCollect.
If resetting happens before this lateCollect (I don't remember in which order they are called), the symfony profiler would store an empty profile.

@derrabus
Copy link
Contributor Author

@stof This applies to any data collector or tracable service used in Symfony. Because of this, the listener that resets the profiler and other resettable services is triggered very late on the kernel.terminate event.

https://github.com/symfony/symfony/blob/8136fa5050761ec375278fe9273d4936a9314ec0/src/Symfony/Component/HttpKernel/EventListener/ServiceResetListener.php#L47

@fabpot
Copy link
Contributor

fabpot commented Sep 27, 2017

Thank you @derrabus.

@fabpot fabpot merged commit ea922bb into twigphp:1.x Sep 27, 2017
fabpot added a commit that referenced this pull request Sep 27, 2017
This PR was merged into the 1.x branch.

Discussion
----------

Added pssibility to reset the profiler

In order to implement symfony/symfony#18244 properly, I needed the ability to reset a Twig profile.

Commits
-------

ea922bb Added pssibility to reset the profiler.
@derrabus derrabus deleted the 1.x-resettable-profiler branch September 28, 2017 08:16
fabpot added a commit to symfony/symfony that referenced this pull request Oct 5, 2017
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle][HttpKernel] Reset profiler

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #18244
| License       | MIT
| Doc PR        | N/A

This PR adds the ability to reset the profiler between requests. Furthermore, the profiler service has been tagged with the new `kernel.reset` tag from #24155. For this, I had to readd the ability to define multiple reset methods for a service.

Note: This PR requires twigphp/Twig#2560.

Commits
-------

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants