remove limit from UserList

This commit is contained in:
yuzuki999
2022-06-13 14:47:01 +08:00
parent 2d279aa202
commit 297d9cc618
3 changed files with 16 additions and 23 deletions

View File

@@ -43,16 +43,16 @@ func (l *Limiter) AddInboundLimiter(tag string, nodeInfo *api.NodeInfo, userList
}
userMap := new(sync.Map)
for i := range *userList {
if (*userList)[i].SpeedLimit == 0 {
/*if (*userList)[i].SpeedLimit == 0 {
(*userList)[i].SpeedLimit = nodeInfo.SpeedLimit
}
if (*userList)[i].DeviceLimit == 0 {
(*userList)[i].DeviceLimit = nodeInfo.DeviceLimit
}
}*/
userMap.Store(fmt.Sprintf("%s|%s|%d", tag, (*userList)[i].GetUserEmail(), (*userList)[i].UID), UserInfo{
UID: (*userList)[i].UID,
SpeedLimit: (*userList)[i].SpeedLimit,
DeviceLimit: (*userList)[i].DeviceLimit,
SpeedLimit: nodeInfo.SpeedLimit,
DeviceLimit: nodeInfo.DeviceLimit,
})
}
inboundInfo.UserInfo = userMap
@@ -66,16 +66,16 @@ func (l *Limiter) UpdateInboundLimiter(tag string, nodeInfo *api.NodeInfo, updat
inboundInfo := value.(*InboundInfo)
// Update User info
for _, u := range *usersIndex {
if (*updatedUserList)[u].SpeedLimit == 0 {
/*if (*updatedUserList)[u].SpeedLimit == 0 {
(*updatedUserList)[u].SpeedLimit = nodeInfo.SpeedLimit
}
if (*updatedUserList)[u].DeviceLimit == 0 {
(*updatedUserList)[u].DeviceLimit = nodeInfo.DeviceLimit
}
}*/
inboundInfo.UserInfo.Store(fmt.Sprintf("%s|%s|%d", tag, (*updatedUserList)[u].GetUserEmail(), (*updatedUserList)[u].UID), UserInfo{
UID: (*updatedUserList)[u].UID,
SpeedLimit: (*updatedUserList)[u].SpeedLimit,
DeviceLimit: (*updatedUserList)[u].DeviceLimit,
SpeedLimit: nodeInfo.SpeedLimit,
DeviceLimit: nodeInfo.DeviceLimit,
})
inboundInfo.BucketHub.Delete(fmt.Sprintf("%s|%s|%d", tag, (*updatedUserList)[u].GetUserEmail(), (*updatedUserList)[u].UID)) // Delete old limiter bucket
}