-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix misc errors that show up in the logs #830
Conversation
Codecov Report
|
05266d8
to
f9a1982
Compare
@@ -269,17 +265,16 @@ def get_team_sets(self) -> List[Set[Player]]: | |||
|
|||
async def wait_hosted(self, timeout: float): | |||
return await asyncio.wait_for( | |||
asyncio.shield(self._is_hosted), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to keep the call to shield
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it doesn't seem to matter. I think I added shield before because it prevented some exception from showing up in the logs when the server was shutting down, but that doesn't seem to happen with events.
error_text = str(e) | ||
if any(msg in error_text for msg in ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, what's more advantageous about using str(e)
over referencing the error message directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't throw an attribute error xD. I think str(e)
is the only standard way to get the error message from an exception, exceptions don't have a message
attribute.
self._logger.warning( | ||
"Malformed game stats reported by %s: '...%s'", | ||
self._player.login, | ||
stats[-20:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm obviously not familiar with this codebase, but stats[-20:]
seem quite ambiguous. What is special about the last 20 elements of this object? Maybe some comments would be useful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just that when these errors happens, it seems like it's always due to truncated data. Having the last few characters just lets you confirm that by seeing if the json structure is terminated or not.
) | ||
return | ||
|
||
self._logger.info("Launching game %s", self.game) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think including which player is launching the game could be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always the host, and the host is included in the string representation of self.game
f9a1982
to
24d260d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright to me.
24d260d
to
4ba0fa1
Compare
4ba0fa1
to
587061d
Compare
deadlock_retry_execute
exception handler