feat(temp): update service temp to event2

This commit is contained in:
bandl 2021-11-11 22:46:20 +08:00
parent 2f81eab981
commit 55204575d7
1 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ package service
import (
context "context"
"gitee.com/wheat-os/wheatCache/pkg/event"
"gitee.com/wheat-os/wheatCache/pkg/event2"
"gitee.com/wheat-os/wheatCache/pkg/lru"
"gitee.com/wheat-os/wheatCache/pkg/proto"
)
@ -15,7 +15,7 @@ func (s *singleService) {{key.method}}(
ctx context.Context,
req *proto.{{key.method}}Request,
) (*proto.{{key.method}}Response, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.{{key.method}}({% for opt in key.option %}req.{{opt[0]}}, {% endfor %})
if err != nil{
return nil, err
@ -28,10 +28,10 @@ func (s *singleService) {{key.method}}(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}