-
-
Notifications
You must be signed in to change notification settings - Fork 169
feat(core)!: worker mode support #2172
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
Open
brendt
wants to merge
30
commits into
3.x
Choose a base branch
from
implement-resettable
base: 3.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,225
−35
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
7b66e87
Make cookie and session resettable
brendt 9f02d93
Support persistent database connections
brendt 86df882
Add TODO
brendt 6370d10
Add tests
brendt 0073f19
Move session auth reset
brendt 6033bd7
Move session auth reset
brendt 4dfc6f1
QA
brendt 4d23e94
QA
brendt 934382d
Small fixes
brendt 8a0b176
QA
brendt 1e231c8
Add WorkerModeApplication
brendt 210862a
Add WorkerModeApplication
brendt 8e94f11
Add deferred tasks reset
brendt 123b528
Add deferred tasks reset
brendt 7f226a5
Handle transactions during reset
brendt 46df469
Kernel cleanup
brendt 244a054
QA
brendt ec3c70e
Refactor connection
brendt 178aefc
Add rectors
brendt d71e8ed
QA
brendt af86656
QA
brendt 9f41096
Improve kernel implementation
brendt ab063ec
Improve kernel implementation
brendt f5af31b
Fix tests
brendt cf16d3c
Prevent stale connections
brendt 16fb507
Fix
brendt a5e550e
QA
brendt 1141cbb
QA
brendt c12790d
QA
brendt e11dedf
QA
brendt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/auth/src/Authentication/SessionAuthenticatorReset.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Tempest\Auth\Authentication; | ||
|
|
||
| use Tempest\Container\Resettable; | ||
|
|
||
| final readonly class SessionAuthenticatorReset implements Resettable | ||
| { | ||
| public function __construct( | ||
| private SessionAuthenticator $sessionAuthenticator, | ||
| ) {} | ||
|
|
||
| public function reset(): void | ||
| { | ||
| $this->sessionAuthenticator->clearCurrent(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace Tempest\Core; | ||
|
|
||
| use Tempest\Container\Container; | ||
| use Tempest\Container\Resettable; | ||
|
|
||
| final readonly class DeferredTasksReset implements Resettable | ||
| { | ||
| public function __construct( | ||
| private Container $container, | ||
| ) {} | ||
|
|
||
| public function reset(): void | ||
| { | ||
| $this->container->unregister(DeferredTasks::class); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,9 @@ | |
|
|
||
| enum KernelEvent | ||
| { | ||
| case SHUTTING_DOWN; | ||
| case RESETTING; | ||
| case RESET; | ||
| case BOOTED; | ||
| case SHUTDOWN; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?php | ||
|
|
||
| namespace Tempest\Database\Connection; | ||
|
|
||
| use Tempest\Container\Container; | ||
| use Tempest\Container\GenericContainer; | ||
| use Tempest\Container\Resettable; | ||
| use Tempest\Database\Exceptions\CouldNotResetConnection; | ||
|
|
||
| final readonly class ConnectionReset implements Resettable | ||
| { | ||
| public function __construct( | ||
| private Container $container, | ||
| ) {} | ||
|
|
||
| public function reset(): void | ||
| { | ||
| // Manually looping over the connection singletons so that we can check whether they still have an active transaction | ||
| if ($this->container instanceof GenericContainer) { | ||
| $connections = $this->container->getSingletons(Connection::class); | ||
|
|
||
| foreach ($connections as $connection) { | ||
| if (! $connection instanceof Connection) { | ||
| continue; | ||
| } | ||
|
|
||
| if ($connection->inTransaction()) { | ||
| throw new CouldNotResetConnection("There's still an active transaction, make sure to close it before ending the request"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| $this->container->unregister(Connection::class, tagged: true); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace Tempest\Database; | ||
|
|
||
| use Tempest\Container\Container; | ||
| use Tempest\Container\Resettable; | ||
|
|
||
| final readonly class DatabaseReset implements Resettable | ||
| { | ||
| public function __construct( | ||
| private Container $container, | ||
| ) {} | ||
|
|
||
| public function reset(): void | ||
| { | ||
| $this->container->unregister(Database::class, tagged: true); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.