コード例 #1
0
        public void Stop()
        {
            _log.Debug("Save and free Hoot storages memory at stopping Search Plugin");
            var accountCollection = ObjectFactory.GetInstance <IAccountCollection>();

            if (accountCollection != null && accountCollection.Any())
            {
                accountCollection.Where(x => x.Profiles.Any())
                .AsParallel()
                .ForEach(a =>
                {
                    _log.DebugFormat("Shutting down indexes for {0} during stopping service", a.Name);
                    _documentIndexProvider.ShutdownDocumentIndexesIfRunning(new PluginContextSnapshot(a.Name, a.Profiles.First().Name, _pluginContext.PluginName), new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: false), _log);
                    _log.DebugFormat("Indexes shutted down for {0} during stopping service", a.Name);
                });
            }
            _log.Debug("Finished to save and free Hoot storages memory at stopping Search Plugin");
        }
コード例 #2
0
 public void Handle(TickMessage message)
 {
     if (_profile.Initialized && _documentIndexSetup.ManagedMemoryThresholdInMb != null)
     {
         long bytes = GC.GetTotalMemory(false);
         _logger.Debug("Managed memory used: {0:N} bytes".Fmt(bytes));
         if (bytes > _documentIndexSetup.ManagedMemoryThresholdInMb * 1024 * 1024)
         {
             _documentIndexProvider.OptimizeDocumentIndexesIfRunning(_pluginContext, _logger);
         }
     }
 }
コード例 #3
0
        public bugCollection GetBugs(int[] bugIDs)
        {
            var content = UploadDataToBugzilla(string.Format("cmd=get_bugs&id={0}", bugIDs.ToString(",")));

            content = ProcessResponse(content);

            _log.Debug("Parsing content");

            if (string.IsNullOrEmpty(content))
            {
                return(new bugCollection());
            }

            var parser   = new BugzillaParser <bugzilla>();
            var bugzilla = parser.Parse(content);

            return(bugzilla.bugCollection);
        }
コード例 #4
0
        public IndexResult AddGeneralIndex(GeneralDTO general)
        {
            if (general.GeneralID == null)
            {
                return(new IndexResult());
            }
            if (Exists <EntityDocument>(general.GeneralID.Value, DocumentIndexTypeToken.Entity))
            {
                if (_profile.Initialized)
                {
                    _log.WarnFormat("CANNOT PROCESS '{0}CreatedMessage' FOR ENTITY #{1} - '{2}'. ENTITY HAS ALREADY BEEN ADDED ON PROFILE INITIALIZATION OR ENTITY CREATION !!!", general.EntityTypeName, general.GeneralID.GetValueOrDefault(), general.Name);
                }
                else
                {
                    _log.ErrorFormat("CANNOT PROCESS '{0}CreatedMessage' FOR ENTITY #{1} - '{2}'. ENTITY HAS ALREADY BEEN ADDED !!!", general.EntityTypeName, general.GeneralID.GetValueOrDefault(), general.Name);
                }
                return(new IndexResult());
            }
            IDocumentIndex entityIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext.AccountName, DocumentIndexTypeToken.Entity);
            EntityDocument document    = _documentFactory.CreateGeneral(general);
            IndexResult    indexResult = document == null ? new IndexResult() : entityIndex.Index(document, false);

            if (indexResult.DocNumber != -1)
            {
                IDocumentIndex projectContextIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext.AccountName, DocumentIndexTypeToken.EntityProject);
                projectContextIndex.Index(indexResult.DocNumber, _documentIdFactory.EncodeProjectId(general.ParentProjectID));
                Maybe <string> maybeEntityTypeName = _entityTypeProvider.GetEntityTypeName(general.EntityTypeID);
                string         entityTypeName      = maybeEntityTypeName.FailIfNothing(() => new ApplicationException("Entity type name was not found {0}".Fmt(general.EntityTypeID)));
                IDocumentIndex entityTypeIndex     = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext.AccountName, DocumentIndexTypeToken.EntityType);
                entityTypeIndex.Index(indexResult.DocNumber, entityTypeName);
            }
            _log.Debug(string.Format("Added {0} #{1} - '{2}':{3}", general.EntityTypeName, general.GeneralID.GetValueOrDefault(), general.Name, indexResult.WordsAdded.Any() ? string.Format(" added words - {0};", string.Join(",", indexResult.WordsAdded.Keys)) : " NO WORDS ADDED;"));
            return(indexResult);
        }