Last Access time is not updated for user

Created on 1 September 2023, over 1 year ago
Updated 13 September 2024, 3 months ago

Last access time is not updated for user

Install plan vanilla Drupal 9.5.10, and create 3 users.
Access the website using these 3 users in different browsers and observe the last access time in the database.
I have observed that the last access time is not updated consistently for all 3 users.

I created 3 users (as shown in the screenshot)
I'm using drupal provided view and I have disabled the cache for this view as well.
now if Shiv1 accesses the website I'm expecting that user "shiv1" should be shown first in this list.
This is not happening. Even I queried the database and observed that the last access time is not updated for shiv1.

🐛 Bug report
Status

Closed: works as designed

Version

11.0 🔥

Component
User system 

Last updated about 4 hours ago

Created by

🇮🇳India shivamitakari

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @shivamitakari
  • Status changed to Postponed: needs info over 1 year ago
  • I do not believe this is a bug.

    UserRequestSubscriber::onKernelTerminate contains:

    if ($this->account->isAuthenticated() && REQUEST_TIME - $this->account->getLastAccessedTime() > Settings::get('session_write_interval', 180)) {
      // Do that no more than once per 180 seconds.
      /** @var \Drupal\user\UserStorageInterface $storage */
      $storage = $this->entityTypeManager->getStorage('user');
      $storage->updateLastAccessTimestamp($this->account, REQUEST_TIME);
    }
    

    So this is subject to the configured session_write_interval, which has a default of 180 seconds.

  • Status changed to Closed: works as designed 3 months ago
  • 🇦🇺Australia pameeela

    No additional info provided so I'm closing this, since it sounds like it works as designed.

Production build 0.71.5 2024