Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac3a77e

Browse files
authored
Merge pull request studygolang#95 from tk103331/master
后台更新节点数据后及时刷新
2 parents ad3d521 + 807db3c commit ac3a77e

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/global/chan.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ var AuthorityChan = make(chan struct{}, 1)
1010
var RoleChan = make(chan struct{}, 1)
1111
var RoleAuthChan = make(chan struct{}, 1)
1212
var UserSettingChan = make(chan struct{}, 1)
13+
var TopicNodeChan = make(chan struct{}, 1)

src/http/controller/admin/node.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package admin
88

99
import (
10+
"global"
1011
"logic"
1112
"model"
1213

@@ -54,6 +55,7 @@ func (NodeController) Modify(ctx echo.Context) error {
5455
if err != nil {
5556
return fail(ctx, 1, err.Error())
5657
}
58+
global.TopicNodeChan <- struct{}{}
5759
return success(ctx, nil)
5860
}
5961

src/server/studygolang/background.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ func loadData() {
100100
logic.LoadRoleAuthorities()
101101
case <-global.UserSettingChan:
102102
logic.LoadUserSetting()
103+
case <-global.TopicNodeChan:
104+
logic.LoadNodes()
103105
}
104106
}
105107
}

0 commit comments

Comments
 (0)