Skip to content

Commit

Permalink
- Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ParticleG committed Aug 6, 2024
1 parent 5f2d2c5 commit 540a833
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/PlayerManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ string PlayerManager::oauth(

int64_t PlayerManager::getPlayerIdByAccessToken(const string& accessToken) {
try {
LOG_DEBUG << "accessId: " << get(data::join({"auth", "access-id", accessToken}, ':'));
return stoll(get(data::join({"auth", "access-id", accessToken}, ':')));
} catch (const redis_exception::KeyNotFound& e) {
throw ResponseException(
Expand All @@ -156,6 +157,7 @@ int64_t PlayerManager::getPlayerIdByAccessToken(const string& accessToken) {

bool PlayerManager::tryRefresh(string& accessToken) {
const auto ttl = chrono::milliseconds(pTtl(data::join({"auth", "access-id", accessToken}, ':')));
LOG_DEBUG << "ttl: " << ttl.count() << ", _refreshExpiration: " << _refreshExpiration.count();
if (ttl.count() == -2) {
throw ResponseException(
i18n("invalidAccessToken"),
Expand All @@ -164,6 +166,7 @@ bool PlayerManager::tryRefresh(string& accessToken) {
);
}
if (ttl < _refreshExpiration) {
LOG_DEBUG << "refreshing";
const auto playerId = getPlayerIdByAccessToken(accessToken);
NO_EXCEPTION(
del(data::join({"auth", "access-id", accessToken}, ':'));
Expand Down

0 comments on commit 540a833

Please sign in to comment.