public void Run()

in src/Library/Host.cs [39:71]


        public void Run(string configuration, TimeSpan checkInterval)
        {
            Task.Run(() =>
            {
                this.isRunning = true;
                this.library = null;

                while (true)
                {
                    try
                    {
                        if (this.library?.IsRunning != true && this.isRunning)
                        {
                            // the library is not running, start a new one
                            lock (this.sync)
                            {
                                if (this.library?.IsRunning != true && this.isRunning)
                                {
                                    this.library = Host.StartNewLibrary(configuration, this.telemetryClient);
                                    this.isRunning = true;
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Diagnostics.LogError(FormattableString.Invariant($"The library has failed to start. We'll restart it in a while. {e.ToString()}"));
                    }

                    Thread.Sleep(checkInterval);
                }
            });
        }