From 3007ca68d5ec1b889b7695028e20e8066240deed Mon Sep 17 00:00:00 2001 From: Deluan Date: Tue, 28 Jan 2020 16:20:59 -0500 Subject: [PATCH] fix: disable User.lastAccessAt field for now. Updating it on every request was cause DB retentions/lock errors --- engine/users.go | 14 +++++++------- ui/src/user/UserEdit.js | 2 +- ui/src/user/UserList.js | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/engine/users.go b/engine/users.go index fde6fd04b37..94b505e7d86 100644 --- a/engine/users.go +++ b/engine/users.go @@ -7,7 +7,6 @@ import ( "fmt" "strings" - "github.com/deluan/navidrome/log" "github.com/deluan/navidrome/model" ) @@ -49,11 +48,12 @@ func (u *users) Authenticate(ctx context.Context, username, pass, token, salt st if !valid { return nil, model.ErrInvalidAuth } - go func() { - err := u.ds.User(ctx).UpdateLastAccessAt(user.ID) - if err != nil { - log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName) - } - }() + // TODO: Find a way to update LastAccessAt without causing too much retention in the DB + //go func() { + // err := u.ds.User(ctx).UpdateLastAccessAt(user.ID) + // if err != nil { + // log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName) + // } + //}() return user, nil } diff --git a/ui/src/user/UserEdit.js b/ui/src/user/UserEdit.js index e2dd582bbec..a84b22aa0ff 100644 --- a/ui/src/user/UserEdit.js +++ b/ui/src/user/UserEdit.js @@ -23,7 +23,7 @@ const UserEdit = (props) => ( - + {/**/} diff --git a/ui/src/user/UserList.js b/ui/src/user/UserList.js index e978d99bce6..40ff4af90f5 100644 --- a/ui/src/user/UserList.js +++ b/ui/src/user/UserList.js @@ -33,8 +33,7 @@ const UserList = (props) => { record.name} secondaryText={(record) => - record.lastAccessAt && - new Date(record.lastAccessAt).toLocaleString() + record.lastLoginAt && new Date(record.lastLoginAt).toLocaleString() } tertiaryText={(record) => (record.isAdmin ? '[admin]️' : '')} /> @@ -42,7 +41,7 @@ const UserList = (props) => { - + )}