Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personalized Communication History Times Out #6148

Open
2 tasks done
azturner opened this issue Jan 5, 2025 · 0 comments
Open
2 tasks done

Personalized Communication History Times Out #6148

azturner opened this issue Jan 5, 2025 · 0 comments

Comments

@azturner
Copy link
Contributor

azturner commented Jan 5, 2025

Description

Reported on behalf of Coastal Community Church

The Personalized Communication History block is consistently timing out for one particular person in Coastal's database. This person has 204 person alias records and is a recipient on about 504 communication records.

After debugging this issue, determined it is the GetCommunicationListItems method in the PersonalizedCommunicationHistory block. After changing this code:

var qryListItems = qryCommunicationRecipients
	.OrderByDescending( c => c.Communication.CreatedDateTime )
	.AsNoTracking()
	.Select( ciGroup =>
		new CommunicationListItem
		{
			RowId = "C" + ciGroup.Communication.Id + "R" + ciGroup.Recipient.Id,
			Id = ciGroup.Communication.Id,
			CommunicationType = ciGroup.Communication.CommunicationType,
			CommunicationStatus = ciGroup.Communication.Status,
			Title = ciGroup.Communication.CommunicationType == CommunicationType.Email ? ciGroup.Communication.Subject
				: ciGroup.Communication.CommunicationType == CommunicationType.SMS ? ciGroup.Communication.Name
				: ciGroup.Communication.CommunicationType == CommunicationType.PushNotification ? ciGroup.Communication.PushTitle
				: ciGroup.Communication.Name,
			CreatedDateTime = ciGroup.Communication.CreatedDateTime,
			SendDateTime = ciGroup.Communication.SendDateTime ?? ciGroup.Communication.FutureSendDateTime ?? ciGroup.Communication.CreatedDateTime,
			Sender = ciGroup.Communication.SenderPersonAlias != null ? ciGroup.Communication.SenderPersonAlias.Person : null,
			RecipientStatus = ciGroup.Recipient.Status,
			RecipientStatusNote = ciGroup.Recipient.StatusNote,
			CreatedByPersonAliasId = ciGroup.Communication.CreatedByPersonAliasId,
			RecipientTotal = ciGroup.Communication.Recipients.Count,
			InternalCommunicationMediumId = ciGroup.Recipient.MediumEntityTypeId
		} );

var items = qryListItems.ToList();

To This:

var listItems = qryCommunicationRecipients
	.AsNoTracking()
	.ToList();

var items = listItems
	.Select( ciGroup =>
		new CommunicationListItem
		{
			RowId = "C" + ciGroup.Communication.Id + "R" + ciGroup.Recipient.Id,
			Id = ciGroup.Communication.Id,
			CommunicationType = ciGroup.Communication.CommunicationType,
			CommunicationStatus = ciGroup.Communication.Status,
			Title = ciGroup.Communication.CommunicationType == CommunicationType.Email ? ciGroup.Communication.Subject
				: ciGroup.Communication.CommunicationType == CommunicationType.SMS ? ciGroup.Communication.Name
				: ciGroup.Communication.CommunicationType == CommunicationType.PushNotification ? ciGroup.Communication.PushTitle
				: ciGroup.Communication.Name,
			CreatedDateTime = ciGroup.Communication.CreatedDateTime,
			SendDateTime = ciGroup.Communication.SendDateTime ?? ciGroup.Communication.FutureSendDateTime ?? ciGroup.Communication.CreatedDateTime,
			Sender = ciGroup.Communication.SenderPersonAlias != null ? ciGroup.Communication.SenderPersonAlias.Person : null,
			RecipientStatus = ciGroup.Recipient.Status,
			RecipientStatusNote = ciGroup.Recipient.StatusNote,
			CreatedByPersonAliasId = ciGroup.Communication.CreatedByPersonAliasId,
			RecipientTotal = ciGroup.Communication.Recipients.Count,
			InternalCommunicationMediumId = ciGroup.Recipient.MediumEntityTypeId
		} )
	.OrderByDescending( c => c.CreatedDateTime )
	.ToList();

The block started working correctly and results were displayed in just a few seconds.

Actual Behavior

Page gets a timeout error

Expected Behavior

Page should not get a timeout error

Steps to Reproduce

Couldn't reproduce on test or new database.

Issue Confirmation

  • Perform a search on the Github Issues to see if your bug or enhancement is already reported.
  • Reproduced the problem on a fresh install or on the demo site.

Rock Version

v16.6

Client Culture Setting

en-US

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants