public TargetedNotificationsCacheProvider(bool enforceCourtesy, TargetedNotificationsProviderBase tnProvider, RemoteSettingsInitializer initializer) { this.enforceCourtesy = enforceCourtesy; this.tnProvider = tnProvider; Storage = initializer.TargetedNotificationsCacheStorage; telemetry = initializer.TargetedNotificationsTelemetry; responseUsesCachedRules = false; }
public TargetedNotificationsProviderBase(IRemoteSettingsStorageHandler cacheableStorageHandler, RemoteSettingsInitializer initializer) : base(cacheableStorageHandler, initializer.RemoteSettingsLogger) { this.cacheableStorageHandler = cacheableStorageHandler; useCache = GetValueOrDefaultFromCacheableStorage("TargetedNotifications", "UseCache", true); enforceCourtesy = GetValueOrDefaultFromCacheableStorage("TargetedNotifications", "EnforceCourtesy", true); cacheTimeoutMs = GetValueOrDefaultFromCacheableStorage("TargetedNotifications", "CacheTimeoutMs", 750); serviceQueryLoopTimeSpan = TimeSpan.FromMinutes(GetValueOrDefaultFromCacheableStorage("TargetedNotifications", "ServiceQueryLoopMinutes", 1440)); liveStorageHandler = initializer.LiveRemoteSettingsStorageHandlerFactory(); remoteSettingsParser = initializer.RemoteSettingsParser; remoteSettingsTelemetry = initializer.Telemetry; targetedNotificationsTelemetry = initializer.TargetedNotificationsTelemetry; experimentationService = initializer.ExperimentationService; telemetryNotificationService = initializer.TelemetryNotificationService; notificationAndCourtesyCache = new TargetedNotificationsCacheProvider(enforceCourtesy, this, initializer); }
public TargetedNotificationsJsonStorageProvider(RemoteSettingsInitializer initializer) { cacheDirectory = initializer.GetLocalAppDataRoot(); cacheFileFullPath = Path.Combine(cacheDirectory, "targetnote_v1.json"); telemetry = initializer.TargetedNotificationsTelemetry; cacheLock = new Lazy <Mutex>(delegate { try { return(new Mutex(false, "Global\\55F58BAB-BDB9-47D5-B85E-B4D8234E8FAA")); } catch (Exception exception) { string eventName = "VS/Core/TargetedNotifications/MutexFailure"; telemetry.PostCriticalFault(eventName, "Failed to create Mutex", exception); return(null); } }); }