-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix misc errors that show up in the logs (#830)
* Clean up formatting * Log decode errors in JsonStats as WARNING instead of ERROR * Ensure that the server will start, even if hydra is unreachable * Log on INFO level when game setup times out * Handle exceptions when processing game stats in a task * Correctly check error text during deadlock handling * Check gamestate before launching * Reduce pop timer log level to info
- Loading branch information
Showing
12 changed files
with
254 additions
and
50 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import asyncio | ||
import os | ||
|
||
import pytest | ||
|
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,41 @@ | ||
from unittest import mock | ||
|
||
import asynctest | ||
import pymysql | ||
import pytest | ||
|
||
from server.db import deadlock_retry_execute | ||
from tests.utils import fast_forward | ||
|
||
|
||
@pytest.mark.asyncio | ||
@fast_forward(10) | ||
async def test_deadlock_retry_execute(): | ||
mock_conn = mock.Mock() | ||
mock_conn.execute = asynctest.CoroutineMock( | ||
side_effect=pymysql.err.OperationalError(-1, "Deadlock found") | ||
) | ||
|
||
with pytest.raises(pymysql.err.OperationalError): | ||
await deadlock_retry_execute(mock_conn, "foo") | ||
|
||
assert mock_conn.execute.call_count == 3 | ||
|
||
|
||
@pytest.mark.asyncio | ||
@fast_forward(10) | ||
async def test_deadlock_retry_execute_success(): | ||
call_count = 0 | ||
|
||
async def execute(*args): | ||
nonlocal call_count | ||
call_count += 1 | ||
if call_count <= 1: | ||
raise pymysql.err.OperationalError(-1, "Deadlock found") | ||
|
||
mock_conn = mock.Mock() | ||
mock_conn.execute = asynctest.CoroutineMock(side_effect=execute) | ||
|
||
await deadlock_retry_execute(mock_conn, "foo") | ||
|
||
assert mock_conn.execute.call_count == 2 |
Oops, something went wrong.