diff options
| author | Elian Van Cutsem <hello@elian.codes> | 2026-07-11 14:04:07 +0200 |
|---|---|---|
| committer | Elian Van Cutsem <hello@elian.codes> | 2026-07-11 14:04:07 +0200 |
| commit | 47f567b6f1ad9729ad3721a5798cab03978300f5 (patch) | |
| tree | 2813920479080d62ed24004fd68ab04364dc34ce /Jellyfin.Server.Implementations/Users/UserManager.cs | |
| parent | 53aafcd38e1f4558ff18f5258d0d46b3a0565783 (diff) | |
Keep authenticated user entity in sync with persisted login timestamps
ExecuteUpdateAsync bypasses the EF change tracker, so the user entity
returned by AuthenticateUser still carried the old LastLoginDate and
LastActivityDate. SessionManager.LogSessionActivity then saved that
stale entity in full, reverting LastLoginDate (usually to null)
milliseconds after every login. Setting the properties on the entity
keeps the follow-up save consistent and lets the 60-second activity
guard skip the redundant write during login.
Fixes #17301
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/UserManager.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 80722af106..a3e5f12382 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -616,6 +616,12 @@ namespace Jellyfin.Server.Implementations.Users .SetProperty(f => f.LastActivityDate, date) .SetProperty(f => f.LastLoginDate, date)) .ConfigureAwait(false); + + // ExecuteUpdateAsync bypasses the change tracker, so keep the + // returned entity in sync. Otherwise SessionManager.LogSessionActivity + // saves this (stale) entity in full and reverts LastLoginDate. + user.LastActivityDate = date; + user.LastLoginDate = date; } await dbContext.Users |
