public JsonTogglerClient(IJsonFlagSerializer serializer, string path) { jsonClientProvider = JsonClientProviderFactory.GetProvider(serializer, path); toggleCollection = new ThreadSafeToggleCollection() { Instance = jsonClientProvider.FetchToggles().Result.ToggleCollection }; var fetchFeatureTogglesTask = new FetchFeatureTogglesTask(jsonClientProvider, toggleCollection); Task statisticsUploader = PeriodicAsync(async() => { try { await fetchFeatureTogglesTask.ExecuteAsync(); } catch (Exception ex) { // Log the exception } }, TimeSpan.FromSeconds(10)); }
public async Task ExecuteAsync() { var result = await jsonClientProvider.FetchToggles(); this.toggleCollection.Instance = result.ToggleCollection; }