fix: spawn process for meiliisearch

This commit is contained in:
Damien 2025-02-25 01:01:16 -05:00
parent fd4f5e594a
commit 81ffe6285f

View File

@ -45,21 +45,13 @@ public class MeilisearchService:IDisposable
Client = new MeilisearchClient("http://localhost:"+meiliConfiguration.MeiliPort ); Client = new MeilisearchClient("http://localhost:"+meiliConfiguration.MeiliPort );
_documentCollection = new ObservableCollection<KeyValuePair<string,IDocument>>(); _documentCollection = new ObservableCollection<KeyValuePair<string,IDocument>>();
_documentCollection.CollectionChanged += CheckIfNeedDocumentSync; _documentCollection.CollectionChanged += CheckIfNeedDocumentSync;
Initialize(); StartMeilisearch();
} }
#region Private #region Private
private async Task EnsureRepositoryIndexExists()
private async void Initialize()
{
await StartMeilisearch();
EnsureMeilisearchIsRunning();
EnsureRepositoryIndexExists();
}
private async void EnsureRepositoryIndexExists()
{ {
Task.Delay(5000).Wait(); Task.Delay(5000).Wait();
var indexes = Client.GetAllIndexesAsync().Result; var indexes = Client.GetAllIndexesAsync().Result;
@ -149,9 +141,9 @@ public class MeilisearchService:IDisposable
FileName = binaryPath, FileName = binaryPath,
Arguments = args, Arguments = args,
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = false,
RedirectStandardError = true, RedirectStandardError = false,
CreateNoWindow = true CreateNoWindow = false
}; };
process = new Process { StartInfo = processStartInfo }; process = new Process { StartInfo = processStartInfo };