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

@@ -241,7 +241,7 @@ namespace ArchiSteamFarm {
private static async Task InitGlobalConfigAndLanguage() {
string globalConfigFile = Path.Combine(SharedInfo.ConfigDirectory, SharedInfo.GlobalConfigFileName);
GlobalConfig = GlobalConfig.Load(globalConfigFile);
GlobalConfig = await GlobalConfig.Load(globalConfigFile).ConfigureAwait(false);
if (GlobalConfig == null) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorGlobalConfigNotLoaded, globalConfigFile));
await Task.Delay(5 * 1000).ConfigureAwait(false);
@@ -250,7 +250,7 @@ namespace ArchiSteamFarm {
}
if (Debugging.IsUserDebugging) {
ASF.ArchiLogger.LogGenericDebug(nameof(GlobalConfig) + ": " + JsonConvert.SerializeObject(GlobalConfig, Formatting.Indented));
ASF.ArchiLogger.LogGenericDebug(SharedInfo.ASF + ": " + JsonConvert.SerializeObject(GlobalConfig, Formatting.Indented));
}
if (GlobalConfig.BackgroundGCPeriod > 0) {
@@ -318,7 +318,7 @@ namespace ArchiSteamFarm {
await Task.Delay(5 * 1000).ConfigureAwait(false);
}
GlobalDatabase = GlobalDatabase.Load(globalDatabaseFile);
GlobalDatabase = await GlobalDatabase.Load(globalDatabaseFile).ConfigureAwait(false);
if (GlobalDatabase == null) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorDatabaseInvalid, globalDatabaseFile));
await Task.Delay(5 * 1000).ConfigureAwait(false);