internal IDocument CreatePeopleRelevanceDocument(PeopleModelItem peopleModelItem, IDocument sentItemsTrainingSubDocument, Guid mailboxGuid, string mailboxAlias) { Util.ThrowOnNullArgument(peopleModelItem, "modelItem"); Util.ThrowOnNullArgument(mailboxAlias, "mailboxAlias"); if (sentItemsTrainingSubDocument == null) { sentItemsTrainingSubDocument = MdbInferenceFactory.Current.CreateDocument(mailboxGuid, true); } Document document = MdbInferenceFactory.Current.CreateDocument(mailboxGuid); document.SetProperty(PeopleRelevanceSchema.MailboxAlias, mailboxAlias); document.SetProperty(PeopleRelevanceSchema.ContactList, peopleModelItem.CreateContactDictionary()); document.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowNumber, peopleModelItem.CurrentTimeWindowNumber); document.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowStartTime, new ExDateTime(ExTimeZone.UtcTimeZone, peopleModelItem.CurrentTimeWindowStartTime.ToUniversalTime())); document.SetProperty(PeopleRelevanceSchema.LastRecipientCacheValidationTime, new ExDateTime(ExTimeZone.UtcTimeZone, peopleModelItem.LastRecipientCacheValidationTime.ToUniversalTime())); document.SetProperty(PeopleRelevanceSchema.LastProcessedMessageSentTime, new ExDateTime(ExTimeZone.UtcTimeZone, peopleModelItem.LastProcessedMessageSentTime.ToUniversalTime())); document.SetProperty(PeopleRelevanceSchema.SentItemsTrainingSubDocument, sentItemsTrainingSubDocument); return(document); }
// Token: 0x060014A4 RID: 5284 RVA: 0x00076AF0 File Offset: 0x00074CF0 internal void ProcessMailbox(MailboxSession session, IDiagnosticsSession diagnosticsSession, bool isRecipientInfoBasedRelevanceEnabled = false) { Util.ThrowOnNullArgument(session, "session"); Util.ThrowOnNullArgument(diagnosticsSession, "diagnosticsSession"); PeopleRelevanceFeeder.Tracer.TraceDebug <Guid>((long)this.GetHashCode(), "Processing Mailbox {0}", session.MailboxGuid); if (string.IsNullOrEmpty(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString())) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Skipping mailbox {0} because owner's primary SMTP address is blank.", new object[] { session }); return; } try { try { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); PeopleModelItem modelData = MdbPeopleModelDataBinderFactory.Current.CreateInstance(session).GetModelData(); PeopleRelevanceFeeder.Tracer.TraceDebug <bool, Version, DateTime>((long)this.GetHashCode(), "Got people inference model item. Default Model = {0} Version = {1} LastModifiedTime = {2} ", modelData.IsDefaultModel, modelData.Version, modelData.LastModifiedTime); IDocument document = null; IEnumerable <IRecipientInfo> enumerable = null; int num = 0; int num2 = 0; int num3; if (isRecipientInfoBasedRelevanceEnabled) { PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "Querying recipients' usage metrics"); enumerable = this.recipientInfoGenerator.RunTrainingQuery(session); num3 = enumerable.Count <IRecipientInfo>(); } else { PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "Running the training query from SentItems"); document = this.sentItemsGenerator.RunTrainingQuery(session, modelData); num3 = document.NestedDocuments.Count; } if (num3 > 0) { IDocument document2 = PeopleRelevanceDocumentFactory.Current.CreatePeopleRelevanceDocument(modelData, document, session.MailboxGuid, session.MailboxOwner.Alias); ExAssert.RetailAssert(document2 != null, "People Relevance document is null"); if (isRecipientInfoBasedRelevanceEnabled) { document2.SetProperty(PeopleRelevanceSchema.RecipientInfoEnumerable, enumerable); } document2.SetProperty(PeopleRelevanceSchema.IsBasedOnRecipientInfoData, isRecipientInfoBasedRelevanceEnabled); document2.SetProperty(PeopleRelevanceSchema.MailboxOwner, new MdbRecipient(session.MailboxOwner, session.PreferedCulture)); PeopleRelevanceFeeder.Tracer.TraceDebug <IIdentity>((long)this.GetHashCode(), "Created a people relevance document Identity - {0}", document2.Identity); this.peopleRelevanceProcessingPipeline.ProcessDocument(document2, new DocumentProcessingContext(session)); stopwatch.Stop(); if (isRecipientInfoBasedRelevanceEnabled) { object obj; if (document2.TryGetProperty(PeopleRelevanceSchema.ContactList, out obj)) { num = (obj as IDictionary <string, IInferenceRecipient>).Count <KeyValuePair <string, IInferenceRecipient> >(); } } else { num = document.NestedDocuments.Count; } num2 = num3 - num; Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ProcessingStatisticsForPeopleRelevanceFeeder, null, new object[] { session.MailboxOwner.LegacyDn, num3, num, num2, stopwatch.Elapsed.TotalMilliseconds }); } else { stopwatch.Stop(); } PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "The people and time feeder for mailbox {0} picked {1} {2} to process. Number of {2} successfully processed {3} and number of items failed to be processed {4}. Total time taken to process this mailbox {5}.", new object[] { session.MailboxOwner.LegacyDn, num3, isRecipientInfoBasedRelevanceEnabled ? "usage metrics" : "sent items", num, num2, stopwatch.Elapsed.TotalMilliseconds }); } catch (MessageSubmissionExceededException ex) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to save model because it's too large. Exception: {0}", new object[] { ex }); } catch (QuotaExceededException ex2) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to reset model or to run training query because mailbox is full. Exception: {0}", new object[] { ex2 }); } catch (NestedDocumentCountZeroException ex3) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "Failed to process training document because it's corrupt. Nested document count is ZERO. Exception: {0}", new object[] { ex3 }); throw; } catch (ObjectNotFoundException ex4) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "Failed to validate recipient cache. Exception: {0}", new object[] { ex4 }); } catch (StorageTransientException ex5) { if (!(ex5.InnerException is MapiExceptionTimeout)) { if (ex5.InnerException is MapiExceptionNetworkError) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of network error.", new object[0]); } throw; } diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of I/O timeout. Exception: {0}", new object[] { ex5 }); } catch (StoragePermanentException ex6) { if (ex6.InnerException is MapiExceptionDatabaseError) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of database-level error. Exception: {0}", new object[] { ex6 }); throw; } if (!(ex6.InnerException is MapiExceptionMaxObjsExceeded)) { throw; } diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to reset model because cannot create user configuration message. Exception: {0}", new object[] { ex6 }); } } catch (ComponentException ex7) { if (ex7.InnerException == null) { throw; } if (ex7.InnerException is ObjectNotFoundException) { diagnosticsSession.TraceError <ComponentException>("Received ObjectNotFoundException from the main pipeline. Exception: {0} ", ex7); } else if (ex7.InnerException is CorruptDataException) { diagnosticsSession.TraceError <ComponentException>("Received CorruptDataException from the main pipeline. Exception: {0}", ex7); } else { if (typeof(StoragePermanentException).IsAssignableFrom(ex7.InnerException.GetType()) || typeof(StorageTransientException).IsAssignableFrom(ex7.InnerException.GetType()) || typeof(DataSourceTransientException).IsAssignableFrom(ex7.InnerException.GetType())) { diagnosticsSession.TraceError <Exception>("Received storage or data source exception from the main pipeline. Exception: {0}", ex7.InnerException); throw ex7.InnerException; } throw; } } }