-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(coroutines): changed SF resetting mechanism so only needed servi…
…ces get reset in first usage
- Loading branch information
Rastusik
committed
Feb 6, 2023
1 parent
c7b31ed
commit 7a568c7
Showing
25 changed files
with
540 additions
and
87 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace K911\Swoole\Bridge\Doctrine\DBAL; | ||
use Doctrine\DBAL\Connection; | ||
use K911\Swoole\Bridge\Symfony\Container\Resetter; | ||
use PixelFederation\DoctrineResettableEmBundle\DBAL\Connection\AliveKeeper; | ||
|
||
final class ConnectionKeepAliveResetter implements Resetter | ||
{ | ||
private AliveKeeper $aliveKeeper; | ||
|
||
private string $connectionName; | ||
|
||
public function __construct(AliveKeeper $aliveKeeper, string $connectionName) | ||
{ | ||
$this->aliveKeeper = $aliveKeeper; | ||
$this->connectionName = $connectionName; | ||
} | ||
|
||
public function reset(object $service): void | ||
{ | ||
if (!$service instanceof Connection) { | ||
throw new \UnexpectedValueException( | ||
\sprintf('Unexpected class instance: %s ', \get_class($service)) | ||
); | ||
} | ||
|
||
$this->aliveKeeper->keepAlive($service, $this->connectionName); | ||
} | ||
} |
This file contains 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 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 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 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
Oops, something went wrong.