Private
Public Access
1
0

handle prod mysql timeout && graphics improve

This commit is contained in:
2016-11-23 22:32:25 +01:00
parent f1ea3654e8
commit ac59cd71aa
3 changed files with 39 additions and 1 deletions

View File

@@ -189,6 +189,8 @@ main {
background: -webkit-linear-gradient(top, rgba(35, 111, 135, 1) 0%, rgba(149, 207, 245, 1) 100%);
background: linear-gradient(to bottom, rgba(35, 111, 135, 1) 0%, rgba(149, 207, 245, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#236f87', endColorstr='#95cff5', GradientType=0);
margin-top: 0;
}
#mine-wrapper .game-wrapper .users .user-container.user-red {

View File

@@ -65,6 +65,7 @@ class MineseekerRpc implements RpcInterface
*/
private function getGrid($gameAssoc)
{
$this->reConnect();
$getsee = array();
$this->em->clear();
@@ -87,6 +88,7 @@ class MineseekerRpc implements RpcInterface
*/
private function saveGrid($data)
{
$this->reConnect();
$playedGame = new PlayedGame();
$grid = new Grid();
@@ -113,4 +115,19 @@ class MineseekerRpc implements RpcInterface
return true;
}
/** Handle prod MySQL timeout */
private function reConnect()
{
try {
$connection = $this->em->getConnection();
if (false === $connection->ping()) {
$connection->close();
$connection->connect();
}
} catch(PDOException $ex) {
throw PDOException::class;
}
}
}

View File

@@ -2,6 +2,7 @@
namespace Mine\SeekerBundle\Topic;
use Doctrine\DBAL\Driver\PDOException;
use Doctrine\ORM\EntityManager;
use Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface;
use Gos\Bundle\WebSocketBundle\Topic\TopicInterface;
@@ -43,7 +44,7 @@ class MineseekerTopic implements TopicInterface
* @param ConnectionInterface $connection
* @param Topic $topic
* @param WampRequest $request
* @return void
* @return void4
*/
public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
{
@@ -131,6 +132,7 @@ class MineseekerTopic implements TopicInterface
*/
private function saveResignToDb($topic, $color)
{
$this->reConnect();
$gameAssoc = explode('/', $topic->getId())[2];
$playedGame = $this->em
@@ -150,6 +152,7 @@ class MineseekerTopic implements TopicInterface
*/
private function saveStepToDb($topic, $event)
{
$this->reConnect();
$gameAssoc = explode('/', $topic->getId())[2];
$playedGame = $this->em
@@ -184,6 +187,7 @@ class MineseekerTopic implements TopicInterface
*/
private function saveUserToDb($topic, $userName, $user, $count)
{
$this->reConnect();
$gameAssoc = explode('/', $topic->getId())[2];
$playedGame = $this->em
@@ -234,4 +238,19 @@ class MineseekerTopic implements TopicInterface
'blueAnon' => null !== $playedGame->getBlueAnon() ? $playedGame->getBlueAnon()->getUserName() : ''
);
}
/** Handle prod MySQL timeout */
private function reConnect()
{
try {
$connection = $this->em->getConnection();
if (false === $connection->ping()) {
$connection->close();
$connection->connect();
}
} catch(PDOException $ex) {
throw PDOException::class;
}
}
}