1
This commit is contained in:
parent
0860ec00d8
commit
d10e631684
@ -17,21 +17,16 @@ func (this *MetaMgr) Init() *MetaMgr {
|
|||||||
this.MetaMgr.Init()
|
this.MetaMgr.Init()
|
||||||
configDir := "../config/"
|
configDir := "../config/"
|
||||||
if !f5.IsOnlineEnv() {
|
if !f5.IsOnlineEnv() {
|
||||||
configDir = "/var/data/conf_test/statserver/"
|
configDir = "/var/data/conf_test/analyseapi/"
|
||||||
}
|
}
|
||||||
metaClasses := &[]f5.MetaClass{
|
metaClasses := &[]f5.MetaClass{
|
||||||
f5.MetaClass{
|
f5.MetaClass{
|
||||||
PrimKey: "InstanceId",
|
PrimKey: "InstanceId",
|
||||||
FileName: configDir + "statserver.cluster.json",
|
FileName: configDir + "analyseapi.cluster.json",
|
||||||
Idx: MT_SERVER_INFO,
|
Idx: MT_SERVER_INFO,
|
||||||
RawMeta: (*mt.ServerInfoMetas)(nil),
|
RawMeta: (*mt.ServerInfoMetas)(nil),
|
||||||
WrapMeta: (*MtwServerInfo)(nil)},
|
WrapMeta: (*MtwServerInfo)(nil)},
|
||||||
f5.MetaClass{
|
}
|
||||||
FileName: configDir + "statserver.json",
|
|
||||||
Idx: MT_CONF,
|
|
||||||
RawMeta: (*mt.ConfMetas)(nil),
|
|
||||||
WrapMeta: (*MtwConf)(nil)},
|
|
||||||
}
|
|
||||||
this.MetaMgr.RegisterMetaClasses(metaClasses)
|
this.MetaMgr.RegisterMetaClasses(metaClasses)
|
||||||
this.Load()
|
this.Load()
|
||||||
return this
|
return this
|
||||||
@ -49,12 +44,3 @@ func (this *MetaMgr) GetServer(instance_id int32) *MtwServerInfo {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MetaMgr) GetConf() *MtwConf {
|
|
||||||
v, ok := this.MetaMgr.GetMetaById(MT_CONF, 1).(*MtwConf)
|
|
||||||
if ok {
|
|
||||||
return v
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -5,23 +5,3 @@ import "mt"
|
|||||||
type MtwServerInfo struct {
|
type MtwServerInfo struct {
|
||||||
*mt.ServerInfo
|
*mt.ServerInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type MtwConf struct {
|
|
||||||
*mt.Conf
|
|
||||||
hearbeatHash map[int32]int32
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MtwConf) Init() {
|
|
||||||
this.hearbeatHash = make(map[int32]int32)
|
|
||||||
for _, v := range this.GetGameHeartbeat() {
|
|
||||||
this.hearbeatHash[v.GetGameid()] = v.GetHeartbeat()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MtwConf) GetHeartBeatTimeout(gameid int32) int32 {
|
|
||||||
if time, ok := this.hearbeatHash[gameid]; ok {
|
|
||||||
return (time + this.GetNetDelay()) * 1000
|
|
||||||
} else {
|
|
||||||
return (60 * 5 + this.GetNetDelay()) * 1000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user