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

Issue #3445902: Apply static caching to the SocialPrivateMessageService #3893

Merged
merged 1 commit into from
May 21, 2024

Conversation

bramtenhove
Copy link
Member

Problem

The updateUnreadCount() function in SocialPrivateMessageService is sometimes called multiple times during a request.

Solution

Apply simple static caching.

Issue tracker

https://www.drupal.org/project/social/issues/3445902

Theme issue tracker

N/a

How to test

  • Send a private message to a user
  • Observe their unread counter remains functional

Screenshots

N/a

Release notes

Minor performance improvement for the private message feature.

Change Record

N/a

Translations

N/a

@bramtenhove bramtenhove added status: needs review This pull request is waiting for a requested review type: performance Improve Open Social performance prio: low team: guardians labels May 8, 2024
@bramtenhove bramtenhove added this to the 12.3.5 milestone May 8, 2024
$user_storage = $this->userManager;
/** @var \Drupal\user\UserInterface $user */
$user = $user_storage->load($uid);
if (!isset($unread)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only actual change together with line 66, the rest is indentation.

@bramtenhove bramtenhove force-pushed the issue/private-message-static-caching branch from fc0858c to 4af1edc Compare May 8, 2024 08:07
@ribel ribel self-requested a review May 8, 2024 11:29
Copy link
Contributor

@ribel ribel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me, also tested and there are no regressions.
image

image

@bramtenhove bramtenhove merged commit 3afd66f into main May 21, 2024
191 checks passed
@bramtenhove bramtenhove deleted the issue/private-message-static-caching branch May 21, 2024 07:31
@bramtenhove bramtenhove added the backport: verified This pull request has been back ported to an older minor version label May 21, 2024
@bramtenhove
Copy link
Member Author

See f4675e7 (12.3.x) and 1d9f048 (12.4.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: verified This pull request has been back ported to an older minor version prio: low status: needs review This pull request is waiting for a requested review team: guardians type: performance Improve Open Social performance
2 participants