refactor: Optimize user caching and token retrieval methods
This commit is contained in:
@@ -252,7 +252,7 @@ func PreConsumeTokenQuota(relayInfo *relaycommon.RelayInfo, quota int) error {
|
||||
//if relayInfo.TokenUnlimited {
|
||||
// return nil
|
||||
//}
|
||||
token, err := model.GetTokenById(relayInfo.TokenId)
|
||||
token, err := model.GetTokenByKey(relayInfo.TokenKey, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
func NotifyRootUser(t string, subject string, content string) {
|
||||
user := model.GetRootUser().ToBaseUser()
|
||||
_ = NotifyUser(&user, dto.NewNotify(t, subject, content, nil))
|
||||
_ = NotifyUser(user, dto.NewNotify(t, subject, content, nil))
|
||||
}
|
||||
|
||||
func NotifyUser(user *model.UserBase, data dto.Notify) error {
|
||||
|
||||
Reference in New Issue
Block a user