Skip to content

Commit ba85a39

Browse files
author
chenjie
committed
update
1 parent 7ab2fc5 commit ba85a39

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

codegen/tml/gomod/template_gomod.go

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ go 1.15
1313
require (
1414
github.com/chenjie199234/Corelib v0.0.6
1515
github.com/fsnotify/fsnotify v1.4.9
16-
github.com/go-redis/redis/v8 v8.4.8
17-
github.com/go-sql-driver/mysql v1.5.0
1816
github.com/golang/protobuf v1.4.3
1917
github.com/segmentio/kafka-go v0.4.8
2018
google.golang.org/protobuf v1.25.0

codegen/tml/server/xrpc/template_xrpc.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ var s *rpc.RpcServer
2828
func StartRpcServer() {
2929
c := source.GetRpcConfig()
3030
rpcc := &stream.InstanceConfig{
31-
SelfName: "{{.}}",
3231
HeartbeatTimeout: time.Duration(c.RpcHeartTimeout),
3332
HeartprobeInterval: time.Duration(c.RpcHeartProbe),
3433
TcpC: &stream.TcpConfig{
@@ -37,7 +36,7 @@ func StartRpcServer() {
3736
},
3837
}
3938
var e error
40-
if s, e = rpc.NewRpcServer(rpcc, time.Duration(c.RpcTimeout), []byte(c.RpcVerifydata)); e != nil {
39+
if s, e = rpc.NewRpcServer(rpcc, api.Group, api.Name, []byte(c.RpcVerifydata), time.Duration(c.RpcTimeout)); e != nil {
4140
log.Error("[xrpc] new rpc server error:", e)
4241
return
4342
}
@@ -64,7 +63,9 @@ func StartRpcServer() {
6463
6564
//StopRpcServer -
6665
func StopRpcServer() {
67-
s.StopRpcServer()
66+
if s != nil {
67+
s.StopRpcServer()
68+
}
6869
}`
6970

7071
const path = "./server/xrpc/"

codegen/tml/server/xweb/template_xweb.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func StartWebServer() {
4343
}
4444
}
4545
var e error
46-
if s, e = web.NewWebServer(webc); e != nil {
46+
if s, e = web.NewWebServer(webc, api.Group, api.Name); e != nil {
4747
log.Error("[xweb] new web server error:", e)
4848
return
4949
}
@@ -70,7 +70,9 @@ func StartWebServer() {
7070
7171
//StopWebServer -
7272
func StopWebServer() {
73-
s.StopWebServer()
73+
if s != nil {
74+
s.StopWebServer()
75+
}
7476
}`
7577

7678
const path = "./server/xweb/"

rpc/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func NewRpcServer(c *stream.InstanceConfig, group, name string, vdata []byte, gl
3939
return nil, e
4040
}
4141
appname := group + "." + name
42-
if e := common.NameCheck(appname, false, true, false, true); e != nil {
42+
if e := common.NameCheck(appname, true, true, false, true); e != nil {
4343
return nil, e
4444
}
4545
serverinstance := &RpcServer{

web/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func NewWebServer(c *Config, group, name string) (*WebServer, error) {
135135
return nil, e
136136
}
137137
appname := group + "." + name
138-
if e := common.NameCheck(appname, false, true, false, true); e != nil {
138+
if e := common.NameCheck(appname, true, true, false, true); e != nil {
139139
return nil, e
140140
}
141141
c.validate()

0 commit comments

Comments
 (0)