Accelerate initial bots startup

Files can be read in parallel after all
This commit is contained in:
JustArchi
2018-05-13 19:19:27 +02:00
parent db3cfbe7d2
commit cbfc7d0e42
7 changed files with 75 additions and 41 deletions

View File

@@ -185,7 +185,7 @@ namespace ArchiSteamFarm {
return IdlingPriorityAppIDs.Contains(appID);
}
internal static BotDatabase Load(string filePath) {
internal static async Task<BotDatabase> Load(string filePath) {
if (string.IsNullOrEmpty(filePath)) {
ASF.ArchiLogger.LogNullError(nameof(filePath));
return null;
@@ -198,7 +198,7 @@ namespace ArchiSteamFarm {
BotDatabase botDatabase;
try {
botDatabase = JsonConvert.DeserializeObject<BotDatabase>(File.ReadAllText(filePath));
botDatabase = JsonConvert.DeserializeObject<BotDatabase>(await File.ReadAllTextAsync(filePath).ConfigureAwait(false));
} catch (Exception e) {
ASF.ArchiLogger.LogGenericException(e);
return null;