/// <summary> /// Starts this instance. /// </summary> public void Start() { if (this._useLocalPayloadStore && this._storeRepository == null) { Debug.WriteLine(this.GetType().Name + ": Initializing StoreContext from: " + nameof(this.Start) + "..."); this._storeRepository = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); this._storeRepository.MakeSureDatabaseExistsAndReady(); Debug.WriteLine(this.GetType().Name + ": Initialized StoreContext from: " + nameof(this.Start) + "."); } if (this._rollbarCommThread == null) { #if NETFX HostingEnvironment.RegisterObject(this); #endif this._rollbarCommThread = new Thread(new ParameterizedThreadStart(this.KeepProcessingAllQueues)) { IsBackground = true, Name = "RollbarProcessor", //Priority = ThreadPriority.AboveNormal, }; this._cancellationTokenSource = new CancellationTokenSource(); this._rollbarCommThread.Start(_cancellationTokenSource.Token); } }
private void EvaluateUseOfLocalPayloadStoreOptions(IRollbarOfflineStoreOptions options) { if (!options.EnableLocalPayloadStore) { if (this._storeRepository != null) { this._storeRepository.Dispose(); this._storeRepository = null; } return; } if (this._storeRepository == null) { this._storeRepository = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); } string?storePath = this.GetLocalPayloadStoreFullPathName(options); if (this._storeRepository != null && !string.IsNullOrWhiteSpace(storePath) && string.Compare(storePath, this._storeRepository.GetRollbarStoreDbFullName(), false) != 0 ) { this._storeRepository.SetRollbarStoreDbFullName(storePath !); } this._storeRepository?.MakeSureDatabaseExistsAndReady(); }
public void GetRespositoryWorksFine() { var repo = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); Assert.IsNotNull(repo, "Repo instance not null"); Assert.IsInstanceOfType(repo, typeof(PayloadStoreRepository), "Valid repo type"); }
private void ReevaluateUseOfLocalPayloadStore() { foreach (var queue in _allQueues) { if (queue.Logger.Config.EnableLocalPayloadStore) { this._useLocalPayloadStore = true; if (this._storeRepository == null) { Debug.WriteLine(this.GetType().Name + ": Initializing StoreContext from: " + nameof(this.ReevaluateUseOfLocalPayloadStore) + "..."); this._storeRepository = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); this._storeRepository.MakeSureDatabaseExistsAndReady(); Debug.WriteLine(this.GetType().Name + ": Initialized StoreContext from: " + nameof(this.ReevaluateUseOfLocalPayloadStore) + "."); } return; } } this._useLocalPayloadStore = false; }
/// <summary> /// Registers the specified queue. /// </summary> /// <param name="queue">The queue.</param> internal void Register(PayloadQueue queue) { lock (this._syncLock) { Assumption.AssertTrue(!this._allQueues.Contains(queue), nameof(queue)); this._allQueues.Add(queue); this.IndexByToken(queue); this._useLocalPayloadStore |= queue.Logger.Config.EnableLocalPayloadStore; if (this._useLocalPayloadStore && this._storeRepository == null) { Debug.WriteLine(this.GetType().Name + ": Initializing StoreContext from: " + nameof(this.Register) + "..."); this._storeRepository = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); this._storeRepository.MakeSureDatabaseExistsAndReady(); Debug.WriteLine(this.GetType().Name + ": Initialized StoreContext from: " + nameof(this.Register) + "."); } ((RollbarConfig)queue.Logger.Config).Reconfigured += Config_Reconfigured; // The following debug line causes stack overflow when RollbarTraceListener is activated: Debug.WriteLineIf(RollbarTraceListener.InstanceCount == 0, this.GetType().Name + ": Registered a queue. Total queues count: " + this._allQueues.Count + "."); } }
public void NakedRollbarShouldProduceException() { PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); }
public void GetRespositoryWorksFine() { var repos = PayloadStoreRepositoryHelper.CreatePayloadStoreRepository(); Assert.IsInstanceOfType(repos, typeof(PayloadStoreRepository)); }