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

Reset application scope to flush scoped instances #313

Merged
merged 6 commits into from
Jun 10, 2021
Merged

Reset application scope to flush scoped instances #313

merged 6 commits into from
Jun 10, 2021

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Jun 9, 2021

This PR calls resetScope() on the main container to reset any scoped instances.

It also moves uses $sandbox->flush() for tasks and ticks so the sandbox is cleared before removing it.

foreach ($event->sandbox->make('config')->get('octane.flush', []) as $binding) {
$event->app->forgetInstance($binding);
$event->sandbox->forgetInstance($binding);
Copy link
Member

Choose a reason for hiding this comment

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

Would this be a breaking change?

Copy link
Member Author

@themsaid themsaid Jun 10, 2021

Choose a reason for hiding this comment

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

No, we already flush the entire sandbox after each operation:

https://github.com/laravel/octane/blob/1.x/src/Worker.php#L114

@taylorotwell taylorotwell merged commit 58516e7 into 1.x Jun 10, 2021
@taylorotwell taylorotwell deleted the pr3223 branch June 10, 2021 13:11
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.

2 participants