Skip to content

Commit

Permalink
deploy: 6312b1e
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Apr 20, 2024
1 parent 1550ab3 commit 2ac3521
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion lobbyconnection.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="title">Module <code>server.lobbyconnection</code></h1>

import aiohttp
from sqlalchemy import and_, func, select
from sqlalchemy.exc import DBAPIError
from sqlalchemy.exc import DBAPIError, OperationalError

import server.metrics as metrics
from server.db import FAFDatabase
Expand Down Expand Up @@ -245,6 +245,16 @@ <h1 class="title">Module <code>server.lobbyconnection</code></h1>
self.get_user_identifier(),
cmd
)
except OperationalError:
# When the database goes down, SqlAlchemy will throw an OperationalError
self._logger.error(&#34;Encountered OperationalError on message received. This could indicate DB is down.&#34;)
await self.send({
&#34;command&#34;: &#34;notice&#34;,
&#34;style&#34;: &#34;error&#34;,
&#34;text&#34;: &#34;Unable to connect to database. Please try again later.&#34;
})
# Make sure to abort here to avoid a thundering herd problem.
await self.abort(&#34;Error connecting to database&#34;)
except Exception as e: # pragma: no cover
await self.send({&#34;command&#34;: &#34;invalid&#34;})
self._logger.exception(e)
Expand Down Expand Up @@ -1532,6 +1542,16 @@ <h2 class="section-title" id="header-classes">Classes</h2>
self.get_user_identifier(),
cmd
)
except OperationalError:
# When the database goes down, SqlAlchemy will throw an OperationalError
self._logger.error(&#34;Encountered OperationalError on message received. This could indicate DB is down.&#34;)
await self.send({
&#34;command&#34;: &#34;notice&#34;,
&#34;style&#34;: &#34;error&#34;,
&#34;text&#34;: &#34;Unable to connect to database. Please try again later.&#34;
})
# Make sure to abort here to avoid a thundering herd problem.
await self.abort(&#34;Error connecting to database&#34;)
except Exception as e: # pragma: no cover
await self.send({&#34;command&#34;: &#34;invalid&#34;})
self._logger.exception(e)
Expand Down Expand Up @@ -3934,6 +3954,16 @@ <h3>Methods</h3>
self.get_user_identifier(),
cmd
)
except OperationalError:
# When the database goes down, SqlAlchemy will throw an OperationalError
self._logger.error(&#34;Encountered OperationalError on message received. This could indicate DB is down.&#34;)
await self.send({
&#34;command&#34;: &#34;notice&#34;,
&#34;style&#34;: &#34;error&#34;,
&#34;text&#34;: &#34;Unable to connect to database. Please try again later.&#34;
})
# Make sure to abort here to avoid a thundering herd problem.
await self.abort(&#34;Error connecting to database&#34;)
except Exception as e: # pragma: no cover
await self.send({&#34;command&#34;: &#34;invalid&#34;})
self._logger.exception(e)
Expand Down

0 comments on commit 2ac3521

Please sign in to comment.