internal static void HealthCheck() { if (IsWorking()) { SnTrace.Index.Write("IAQ: Health check triggered but ignored."); return; } SnTrace.Index.Write("IAQ: Health check triggered."); var state = TerminationHistory.GetCurrentState(); var gapsLength = state.Gaps.Length; if (gapsLength > 0) { SnTrace.IndexQueue.Write("IAQ: Health checker is processing {0} gap{1}.", gapsLength, gapsLength > 1 ? "s" : ""); var notLoadedIds = state.Gaps.ToList(); foreach (var indexingActivity in new IndexingActivityLoader(state.Gaps, false)) { var activity = (IndexingActivityBase)indexingActivity; WaitIfOverloaded(); ExecuteActivity(activity); notLoadedIds.Remove(activity.Id); } if (notLoadedIds.Count > 0) { TerminationHistory.RemoveGaps(notLoadedIds); SnTrace.IndexQueue.Write("IAQ: Health checker ignores the following activity ids after processing the gaps: {0}", notLoadedIds); } } var lastId = TerminationHistory.GetLastTerminatedId(); var lastDbId = IndexManager.GetLastStoredIndexingActivityId(); if (lastId < lastDbId) { SnTrace.IndexQueue.Write("IAQ: Health checker is processing activities from {0} to {1}", (lastId + 1), lastDbId); foreach (var indexingActivity in new IndexingActivityLoader(lastId + 1, lastDbId, false)) { var activity = (IndexingActivityBase)indexingActivity; WaitIfOverloaded(); ExecuteActivity(activity); } } }
internal static void HealthCheck() { if (IsWorking()) { SnTrace.Index.Write("IAQ: Health check triggered but ignored."); return; } SnTrace.Index.Write("IAQ: Health check triggered."); var state = TerminationHistory.GetCurrentState(); var gapsLength = state.Gaps.Length; if (gapsLength > 0) { SnTrace.IndexQueue.Write("IAQ: Health checker is processing {0} gap{1}.", gapsLength, gapsLength > 1 ? "s" : ""); foreach (LuceneIndexingActivity activity in new IndexingActivityLoader(state.Gaps, false)) { WaitIfOverloaded(); IndexingActivityQueue.ExecuteActivity(activity); } } var lastId = TerminationHistory.GetLastTerminatedId(); var lastDbId = LuceneManager.GetLastStoredIndexingActivityId(); var newerCount = lastDbId - lastId; if (lastId < lastDbId) { SnTrace.IndexQueue.Write("IAQ: Health checker is processing activities from {0} to {1}", (lastId + 1), lastDbId); foreach (LuceneIndexingActivity activity in new IndexingActivityLoader(lastId + 1, lastDbId, false)) { WaitIfOverloaded(); IndexingActivityQueue.ExecuteActivity(activity); } } }
internal static void HealthCheck() { if (IsWorking()) { SnTrace.Security.Write("SAQ: Health check triggered but ignored."); return; } SnTrace.Security.Write("SAQ: Health check triggered."); var state = TerminationHistory.GetCurrentState(); var gapsLength = state.Gaps.Length; if (gapsLength > 0) { SnTrace.SecurityQueue.Write("SAQ: Health checker is processing {0} gap{1}.", gapsLength, gapsLength > 1 ? "s" : ""); var notLoaded = state.Gaps.ToList(); foreach (var activity in new SecurityActivityLoader(state.Gaps, false)) { SecurityActivityQueue.ExecuteActivity(activity); // memorize executed notLoaded.Remove(activity.Id); } // forget not loaded activities. TerminationHistory.RemoveFromGaps(notLoaded); } var lastId = TerminationHistory.GetLastTerminatedId(); var lastDbId = DataHandler.GetLastSecurityActivityId(SecurityContext.StartedAt); if (lastId < lastDbId) { SnTrace.SecurityQueue.Write("SAQ: Health checker is processing activities from {0} to {1}", lastId + 1, lastDbId); foreach (var activity in new SecurityActivityLoader(lastId + 1, lastDbId, false)) { SecurityActivityQueue.ExecuteActivity(activity); } } }