Fix(soap): Handle downed game server gracefully
dantav opened this issue · comments
Get POD errors when a subscriber or anyone else tries logging in while game server is down. Errors also on character view. User needs messaging that game server is under maintenance.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I was thinking more of the lines of either some try/catch with api calls or something simple like this.
public static function checkConnection()
{
$inst = static::I();
$soap = $inst->getServerSoap();
if($soap->serverInfo() == "Could not connect to host") return false;
else return true;
}
Then for pages that use the service calls I would do this first.
if(!ACoreServices::checkConnection())
{
echo "<br /><h4 style='text-align: center'>Game server is under maintenance, please check back later</h4>";
}
else {
..
There is probably a cleaner way of doing this. But the point is we need to gate service calls to check if game server is up.
Probably is a good thing to add as an extra warning, but not as a raising error, because will cause to block access to the wp-admin view.
Feel free to propose a PR, we will be happy to get more help.