Skip to content

Commit

Permalink
fix contractID issue in desc package
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannm committed May 21, 2022
1 parent 2bbeb04 commit 1b67aa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions desc/desc.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package desc

import (
"fmt"

"github.com/clubpay/ronykit"
"github.com/clubpay/ronykit/utils"
"github.com/clubpay/ronykit/utils/reflector"
)

Expand Down Expand Up @@ -222,7 +223,7 @@ func (s Service) Generate() ronykit.Service {

contracts := make([]ronykit.Contract, len(c.RouteSelectors))
for idx, s := range c.RouteSelectors {
ci := (&contractImpl{id: utils.Int64ToStr(index)}).
ci := (&contractImpl{id: fmt.Sprintf("%s.%d", svc.name, index)}).
addHandler(svc.pre...).
addHandler(c.Handlers...).
addHandler(svc.post...).
Expand Down
6 changes: 2 additions & 4 deletions edge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (t testBundle) Dispatch(ctx *ronykit.Context, in []byte) (ronykit.ExecuteAr
return err
},
ServiceName: "testService",
ContractID: "1",
ContractID: "testService.1",
Route: "someRoute",
}, nil
}
Expand All @@ -144,10 +144,8 @@ func TestServer(t *testing.T) {
AddSelector(testSelector{}).
AddHandler(
func(ctx *ronykit.Context) {
m := ctx.In().GetMsg()

ctx.Out().
SetMsg(m).
SetMsg(ctx.In().GetMsg()).
Send()

return
Expand Down

0 comments on commit 1b67aa7

Please sign in to comment.