Skip to content

Commit c8b5fad

Browse files
committed
fix: stream sync issue #892
1 parent 2dbb2f5 commit c8b5fad

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

internal/stream/sync.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@ package stream
22

33
import (
44
"encoding/json"
5+
56
"github.com/0xJacky/Nginx-UI/internal/nginx"
67
"github.com/0xJacky/Nginx-UI/model"
78
"github.com/0xJacky/Nginx-UI/query"
89
"github.com/gin-gonic/gin"
910
"github.com/go-resty/resty/v2"
10-
"github.com/samber/lo"
1111
"github.com/uozi-tech/cosy/logger"
1212
)
1313

1414
// getSyncNodes returns the nodes that need to be synchronized by site name
1515
func getSyncNodes(name string) (nodes []*model.Environment) {
1616
configFilePath := nginx.GetConfPath("streams-available", name)
17-
s := query.Site
18-
site, err := s.Where(s.Path.Eq(configFilePath)).
19-
Preload(s.SiteCategory).First()
17+
s := query.Stream
18+
stream, err := s.Where(s.Path.Eq(configFilePath)).First()
2019
if err != nil {
2120
logger.Error(err)
2221
return
2322
}
2423

25-
syncNodeIds := site.SyncNodeIDs
26-
// inherit sync node ids from site category
27-
if site.SiteCategory != nil {
28-
syncNodeIds = append(syncNodeIds, site.SiteCategory.SyncNodeIds...)
29-
}
30-
syncNodeIds = lo.Uniq(syncNodeIds)
24+
syncNodeIds := stream.SyncNodeIDs
3125

3226
e := query.Environment
3327
nodes, err = e.Where(e.ID.In(syncNodeIds...)).Find()

0 commit comments

Comments
 (0)