Code review

This commit is contained in:
JustArchi
2016-09-21 18:22:27 +02:00
parent 6489502be7
commit e2a8c14a0d
3 changed files with 66 additions and 63 deletions

View File

@@ -921,24 +921,22 @@ namespace ArchiSteamFarm {
await SessionSemaphore.WaitAsync().ConfigureAwait(false);
if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
try {
if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) {
return true;
}
bool? isLoggedIn = await IsLoggedIn().ConfigureAwait(false);
if (isLoggedIn.GetValueOrDefault(true)) {
LastSessionRefreshCheck = DateTime.Now;
return true;
} else {
Logging.LogGenericInfo("Refreshing our session!", Bot.BotName);
return await Bot.RefreshSession().ConfigureAwait(false);
}
} finally {
SessionSemaphore.Release();
return true;
}
bool result;
bool? isLoggedIn = await IsLoggedIn().ConfigureAwait(false);
if (isLoggedIn.GetValueOrDefault(true)) {
result = true;
LastSessionRefreshCheck = DateTime.Now;
} else {
Logging.LogGenericInfo("Refreshing our session!", Bot.BotName);
result = await Bot.RefreshSession().ConfigureAwait(false);
}
SessionSemaphore.Release();
return result;
}
private async Task<bool> UnlockParentalAccount(string parentalPin) {