@@ -39,7 +39,7 @@ func NewService(cfg *config.Runtime) *Service {
3939}
4040
4141func (s * Service ) ResetAll () error {
42- log .Warn ("Resetting internal cache" )
42+ log .Warn ("Resetting internal cache. All pending invocations will return nil " )
4343 prevChan := s .channel
4444 s .channel = make (chan * Invocation , 100 )
4545 if prevChan != nil {
@@ -62,9 +62,11 @@ func (s Service) GetNextInvocation() (*Invocation, error) {
6262}
6363
6464func (s Service ) PushInvocation (body string ) (string , error ) {
65+ log .Debugf ("Pushing new invocation: %v" , body )
6566 var b interface {}
6667 err := json .Unmarshal ([]byte (body ), & b )
6768 if err != nil {
69+ log .Errorf ("Invalid JSON: %v" , err )
6870 return "" , err
6971 }
7072
@@ -77,6 +79,7 @@ func (s Service) PushInvocation(body string) (string, error) {
7779 }
7880
7981 invocation .Timeout = now .Add (time .Duration (s .config .TimeoutInSeconds ) * time .Second )
82+ log .Debugf ("Invocation ID: %v" , invocation .Id )
8083
8184 s .holder [invocation .Id ] = & invocation
8285 s .channel <- & invocation
@@ -97,11 +100,12 @@ func (s Service) SendResponse(id string, body []byte) error {
97100 }
98101
99102 var b interface {}
100- err := json .Unmarshal ([] byte ( body ) , & b )
103+ err := json .Unmarshal (body , & b )
101104 if err != nil {
102105 return err
103106 }
104107
108+ log .Debugf ("Response received %v: %v" , id , b )
105109 diff := now .Sub (inv .StartedAt )
106110
107111 inv .Response = b
@@ -130,6 +134,8 @@ func (s Service) SendError(id string, error *RuntimeError, errorType string) err
130134 inv .ErrorType = & errorType
131135 }
132136
137+ log .Debugf ("Error received %v: %v,%v" , id , error , errorType )
138+
133139 diff := now .Sub (inv .StartedAt )
134140 inv .Duration = utils .ToPointer (int (diff .Seconds ()))
135141 return nil
0 commit comments