fix: disable User.lastAccessAt field for now.
Updating it on every request was cause DB retentions/lock errors
This commit is contained in:
+7
-7
@@ -7,7 +7,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/deluan/navidrome/log"
|
|
||||||
"github.com/deluan/navidrome/model"
|
"github.com/deluan/navidrome/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,11 +48,12 @@ func (u *users) Authenticate(ctx context.Context, username, pass, token, salt st
|
|||||||
if !valid {
|
if !valid {
|
||||||
return nil, model.ErrInvalidAuth
|
return nil, model.ErrInvalidAuth
|
||||||
}
|
}
|
||||||
go func() {
|
// TODO: Find a way to update LastAccessAt without causing too much retention in the DB
|
||||||
err := u.ds.User(ctx).UpdateLastAccessAt(user.ID)
|
//go func() {
|
||||||
if err != nil {
|
// err := u.ds.User(ctx).UpdateLastAccessAt(user.ID)
|
||||||
log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName)
|
// if err != nil {
|
||||||
}
|
// log.Error(ctx, "Could not update user's lastAccessAt", "user", user.UserName)
|
||||||
}()
|
// }
|
||||||
|
//}()
|
||||||
return user, nil
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const UserEdit = (props) => (
|
|||||||
<PasswordInput source="password" validate={[required()]} />
|
<PasswordInput source="password" validate={[required()]} />
|
||||||
<BooleanInput source="isAdmin" initialValue={false} />
|
<BooleanInput source="isAdmin" initialValue={false} />
|
||||||
<DateField source="lastLoginAt" showTime />
|
<DateField source="lastLoginAt" showTime />
|
||||||
<DateField source="lastAccessAt" showTime />
|
{/*<DateField source="lastAccessAt" showTime />*/}
|
||||||
<DateField source="updatedAt" showTime />
|
<DateField source="updatedAt" showTime />
|
||||||
<DateField source="createdAt" showTime />
|
<DateField source="createdAt" showTime />
|
||||||
</SimpleForm>
|
</SimpleForm>
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ const UserList = (props) => {
|
|||||||
<SimpleList
|
<SimpleList
|
||||||
primaryText={(record) => record.name}
|
primaryText={(record) => record.name}
|
||||||
secondaryText={(record) =>
|
secondaryText={(record) =>
|
||||||
record.lastAccessAt &&
|
record.lastLoginAt && new Date(record.lastLoginAt).toLocaleString()
|
||||||
new Date(record.lastAccessAt).toLocaleString()
|
|
||||||
}
|
}
|
||||||
tertiaryText={(record) => (record.isAdmin ? '[admin]️' : '')}
|
tertiaryText={(record) => (record.isAdmin ? '[admin]️' : '')}
|
||||||
/>
|
/>
|
||||||
@@ -42,7 +41,7 @@ const UserList = (props) => {
|
|||||||
<Datagrid rowClick="edit">
|
<Datagrid rowClick="edit">
|
||||||
<TextField source="userName" />
|
<TextField source="userName" />
|
||||||
<BooleanField source="isAdmin" />
|
<BooleanField source="isAdmin" />
|
||||||
<DateField source="lastAccessAt" locales="pt-BR" />
|
<DateField source="lastLoginAt" locales="pt-BR" />
|
||||||
<DateField source="updatedAt" locales="pt-BR" />
|
<DateField source="updatedAt" locales="pt-BR" />
|
||||||
</Datagrid>
|
</Datagrid>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user