From 18ebd99e4b388f4d004ae552a0d472695061b37d Mon Sep 17 00:00:00 2001 From: pangdogs Date: Sun, 21 Apr 2024 17:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service_instance.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/service_instance.go b/service_instance.go index b4f09962..53da9c12 100644 --- a/service_instance.go +++ b/service_instance.go @@ -59,6 +59,15 @@ func (instance *ServiceInstance) GetRPC() rpc.IRPC { return rpc.Using(instance) } +// GetStartupIdx 获取启动索引 +func (instance *ServiceInstance) GetStartupIdx() int { + v, _ := instance.GetMemKVs().Load("startup.idx") + if v == nil { + panic("service memory startup.idx not existed") + } + return v.(int) +} + // GetStartupConf 获取启动参数配置 func (instance *ServiceInstance) GetStartupConf() *viper.Viper { v, _ := instance.GetMemKVs().Load("startup.conf")