forked from p53841790/wheat-cache
feat(temp): update service temp to event2
This commit is contained in:
parent
2f81eab981
commit
55204575d7
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue