From 2bb6f4de0ffd9b1f035e53666524da4d13b01f63 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 21 Sep 2022 16:36:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=9C=8D=E5=8A=A1=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=BC=82=E5=B8=B8=E6=A3=80=E6=B5=8B=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/gameconfig.go | 12 ++++++------ lego/core/cbase/servicebase.go | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/comm/gameconfig.go b/comm/gameconfig.go index 93ffcf744..0b49da264 100644 --- a/comm/gameconfig.go +++ b/comm/gameconfig.go @@ -13,12 +13,12 @@ type GameConfig struct { //区服db配置 type DBConfig struct { - RedisIsCluster bool //redis 是否是集群模式 - RedisAddr string //redis 地址 - RedisPassword string //redis 密码 - RedisDB int32 //redis db - MongodbUrl string //mgondb 地址 - MongodbDatabase string //数据库地址 + RedisIsCluster bool //redis 是否是集群模式 + RedisAddr []string //redis 地址 + RedisPassword string //redis 密码 + RedisDB int32 //redis db + MongodbUrl string //mgondb 地址 + MongodbDatabase string //数据库地址 } //服务配置 diff --git a/lego/core/cbase/servicebase.go b/lego/core/cbase/servicebase.go index 67ac0dbdc..57774cb9f 100644 --- a/lego/core/cbase/servicebase.go +++ b/lego/core/cbase/servicebase.go @@ -49,6 +49,7 @@ type ServiceBase struct { //服务初始化过程 完成 系统 和 服务组件的 初始化过程 func (this *ServiceBase) Init(service core.IService) (err error) { + defer lego.Recover("Service Init") this.closesig = make(chan string, 1) this.service = service this.modules = make(map[core.M_Modules]*defaultModule) @@ -80,6 +81,7 @@ func (this *ServiceBase) OnInstallComp(cops ...core.IServiceComp) { //启动服务 完成服务组件的启动过程 func (this *ServiceBase) Start() (err error) { + defer lego.Recover("Service Start") for _, v := range this.comps { err = v.Start() if err != nil { @@ -93,6 +95,7 @@ func (this *ServiceBase) Start() (err error) { //运行模块 func (this *ServiceBase) Run(mod ...core.IModule) { go func() { + defer lego.Recover("Service Run") for _, v := range mod { //初始化模块对象 分配配置参数 if sf, ok := this.service.GetSettings().Modules[string(v.GetType())]; ok { this.modules[v.GetType()] = &defaultModule{