make python app load a bit eariler, making startup a bit faster

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-13 18:13:15 +02:00
parent e329e5bb67
commit cfd5483a18
31 changed files with 183 additions and 124 deletions
+8 -8
View File
@@ -33,7 +33,7 @@ public partial class App
private IMediator _mediator = null!;
private FormState _formState = null!;
private PythonResourceLoader _resourceLoader = null!;
private readonly PythonResourceLoader _resourceLoader = new();
private Stream _securedConfig = null!;
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
@@ -54,7 +54,7 @@ public partial class App
"Azaion.Dataset"
];
private ApiConfig ReadConfig()
private static ApiConfig ReadConfig()
{
try
{
@@ -69,8 +69,9 @@ public partial class App
return new ApiConfig
{
Url = SecurityConstants.DEFAULT_API_URL,
RetryCount = SecurityConstants.DEFAULT_API_RETRY_COUNT ,
TimeoutSeconds = SecurityConstants.DEFAULT_API_TIMEOUT_SECONDS
RetryCount = SecurityConstants.DEFAULT_API_RETRY_COUNT,
TimeoutSeconds = SecurityConstants.DEFAULT_API_TIMEOUT_SECONDS,
ResourcesFolder = ""
};
}
}
@@ -81,10 +82,9 @@ public partial class App
var login = new Login();
login.CredentialsEntered += (_, credentials) =>
{
var apiConfig = ReadConfig();
var api = AzaionApiClient.Create(credentials, apiConfig);
_resourceLoader = new PythonResourceLoader(apiConfig, credentials, api);
var config = ReadConfig();
credentials.Folder = config.ResourcesFolder;
_resourceLoader.Login(credentials);
_securedConfig = _resourceLoader.LoadFileFromPython("secured-config.json");
AppDomain.CurrentDomain.AssemblyResolve += (_, a) =>