-
Notifications
You must be signed in to change notification settings - Fork 34
/
online.go
37 lines (32 loc) · 839 Bytes
/
online.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package backend
import (
"github.com/TeaWeb/code/teaconfigs"
"github.com/TeaWeb/code/teaproxy"
"github.com/iwind/TeaGo/actions"
)
type OnlineAction actions.Action
// 上线服务器
func (this *OnlineAction) Run(params struct {
ServerId string
LocationId string
Websocket bool
BackendId string
}) {
server := teaconfigs.NewServerConfigFromId(params.ServerId)
if server == nil {
this.Fail("找不到Server")
}
runningServer := teaproxy.SharedManager.FindServer(server.Id)
if runningServer != nil {
backendList, _ := runningServer.FindBackendList(params.LocationId, params.Websocket)
if backendList != nil {
backend := backendList.FindBackend(params.BackendId)
if backend != nil {
backend.IsDown = false
backend.CurrentFails = 0
runningServer.SetupScheduling(false)
}
}
}
this.Success()
}