public async Task StartAddOnBackgroundMaintenance(CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) { if (!_safeguardLogic.PauseBackgroundMaintenance) { try { using var sgConnection = GetSgConnection(); if (sgConnection != null) { _safeguardLogic.CheckAndSyncSecretsBrokerInstance(sgConnection); _safeguardLogic.CheckAndPushAddOnCredentials(sgConnection); _safeguardLogic.CheckAndConfigureAddonPlugins(sgConnection); _safeguardLogic.CheckAndSyncVaultCredentials(sgConnection); } } catch (Exception ex) { _logger.Error(ex, $"[Background Maintenance] {ex.Message}"); } } await Task.Delay(TimeSpan.FromMinutes(1), cancellationToken); } }