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

Keep reference to the request until after the transaction is finished #879

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

stayallive
Copy link
Collaborator

@stayallive stayallive commented Sep 8, 2024

Would appreciate some constructive feedback, learning Symfony on the fly here.

My first attempt was a static variable on the RequestFetcher class which is less optimal because it's static it could be kept around longer then needed or have some conflicting state.

So I refactored this to the current RequestFetcher instance obtained from the container and place the current request as an instance variable on here.

If there is a "better" way that achieves the same all ears!

The reason we need to do this is because when we are finishing the transaction in the kernel's terminate event the RequestStack is already emptied and we thus no longer can resolve the current request and the RequestFetcher will thus fail to fetch the request. To work around this we set the current request on the RequestFetcher ourselfs when we start tracing and keep it around until after we finish the transaction.

Fixes #818

@stayallive stayallive changed the title Allow us to set the current request in the request fetcher Keep reference to the request until after the transaction is finished Sep 8, 2024
@cleptric cleptric enabled auto-merge (squash) September 26, 2024 10:05
@cleptric cleptric merged commit 1bc2033 into master Sep 26, 2024
36 checks passed
@cleptric cleptric deleted the fix-missing-requests-data branch September 26, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RequestFetcher doesn't return request
2 participants