Skip to content

Commit

Permalink
fix: vcs event postgres publish error (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
leg100 authored Apr 21, 2023
1 parent d0ee5e2 commit 265bf49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions repo/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.Publish(otf.Event{
Type: otf.EventVCS,
Payload: event,
// publish vcs events only to the local node; a "run spawner" and a
// "module publisher" subscribe to vcs events on each node, so it is
// only necessary to send event to local node; sending it to other
// nodes would lead to duplicate runs and modules being spawned and
// published.
Local: true,
})
}
}
2 changes: 1 addition & 1 deletion repo/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func TestWebhookHandler(t *testing.T) {
publisher := &fakePublisher{}
want := otf.Event{Type: otf.EventVCS, Payload: cloud.VCSPushEvent{}}
want := otf.Event{Type: otf.EventVCS, Payload: cloud.VCSPushEvent{}, Local: true}
f := newTestFactory(t, cloud.VCSPushEvent{})
hook := newTestHook(t, f, otf.String("123"))
handler := handler{
Expand Down

0 comments on commit 265bf49

Please sign in to comment.