fix(node): NodeId filter to FilterNodeParams and update cache clearing logic
This commit is contained in:
parent
25c7eb3927
commit
d6fcff1fee
@ -32,6 +32,7 @@ type FilterParams struct {
|
|||||||
type FilterNodeParams struct {
|
type FilterNodeParams struct {
|
||||||
Page int // Page Number
|
Page int // Page Number
|
||||||
Size int // Page Size
|
Size int // Page Size
|
||||||
|
NodeId []int64 // Node IDs
|
||||||
ServerId []int64 // Server IDs
|
ServerId []int64 // Server IDs
|
||||||
Tag []string // Tags
|
Tag []string // Tags
|
||||||
Search string // Search Address or Name
|
Search string // Search Address or Name
|
||||||
@ -77,6 +78,9 @@ func (m *customServerModel) FilterNodeList(ctx context.Context, params *FilterNo
|
|||||||
s := "%" + params.Search + "%"
|
s := "%" + params.Search + "%"
|
||||||
query = query.Where("`name` LIKE ? OR `address` LIKE ? OR `tags` LIKE ? OR `port` LIKE ? ", s, s, s, s)
|
query = query.Where("`name` LIKE ? OR `address` LIKE ? OR `tags` LIKE ? OR `port` LIKE ? ", s, s, s, s)
|
||||||
}
|
}
|
||||||
|
if len(params.NodeId) > 0 {
|
||||||
|
query = query.Where("id IN ?", params.NodeId)
|
||||||
|
}
|
||||||
if len(params.ServerId) > 0 {
|
if len(params.ServerId) > 0 {
|
||||||
query = query.Where("server_id IN ?", params.ServerId)
|
query = query.Where("server_id IN ?", params.ServerId)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -470,10 +470,10 @@ func (l *ActivateOrderLogic) clearServerCache(ctx context.Context, sub *subscrib
|
|||||||
tags := strings.Split(sub.NodeTags, ",")
|
tags := strings.Split(sub.NodeTags, ",")
|
||||||
|
|
||||||
err := l.svc.NodeModel.ClearNodeCache(ctx, &node.FilterNodeParams{
|
err := l.svc.NodeModel.ClearNodeCache(ctx, &node.FilterNodeParams{
|
||||||
Page: 1,
|
Page: 1,
|
||||||
Size: 1000,
|
Size: 1000,
|
||||||
ServerId: nodeIds,
|
NodeId: nodeIds,
|
||||||
Tag: tags,
|
Tag: tags,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WithContext(ctx).Error("[Order Queue] Clear node cache failed", logger.Field("error", err.Error()))
|
logger.WithContext(ctx).Error("[Order Queue] Clear node cache failed", logger.Field("error", err.Error()))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user