Skip to content

Commit

Permalink
Fix system events recursive triggering (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
mthenw authored Aug 2, 2018
1 parent fb79ad3 commit 8373e92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ func (router *Router) emitSystemEventReceived(path string, event eventpkg.Event,
}

func (router *Router) emitSystemFunctionInvoking(space string, functionID function.ID, event eventpkg.Event) error {
if event.IsSystem() {
return nil
}

system := eventpkg.New(
eventpkg.SystemFunctionInvokingType,
mimeJSON,
Expand All @@ -464,6 +468,10 @@ func (router *Router) emitSystemFunctionInvoking(space string, functionID functi
}

func (router *Router) emitSystemFunctionInvoked(space string, functionID function.ID, event eventpkg.Event, result []byte) error {
if event.IsSystem() {
return nil
}

system := eventpkg.New(
eventpkg.SystemFunctionInvokedType,
mimeJSON,
Expand All @@ -476,6 +484,10 @@ func (router *Router) emitSystemFunctionInvoked(space string, functionID functio
}

func (router *Router) emitSystemFunctionInvocationFailed(space string, functionID function.ID, event eventpkg.Event, err error) {
if event.IsSystem() {
return
}

if _, ok := err.(*function.ErrFunctionError); ok {
system := eventpkg.New(
eventpkg.SystemFunctionInvocationFailedType,
Expand Down

0 comments on commit 8373e92

Please sign in to comment.