Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Maybe fix watch. Fixes #2678 #2719

Merged
merged 5 commits into from
Apr 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Maybe fix watch. Fixes #2678
  • Loading branch information
alexec committed Apr 16, 2020
commit 9446416fac9526d87a21f365dcd86e144b7b8ef6
14 changes: 7 additions & 7 deletions pkg/apiclient/watch-intermediary.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ type watchIntermediary struct {
events chan *workflowpkg.WorkflowWatchEvent
}

func (w watchIntermediary) Send(e *workflowpkg.WorkflowWatchEvent) error {
w.events <- e
return nil
}

func (w watchIntermediary) Recv() (*workflowpkg.WorkflowWatchEvent, error) {
select {
case e := <-w.error:
return nil, e
default:
return <-w.events, nil
case event := <-w.events:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps take a look at the the open bool? Perhaps the watch is getting closed

Suggested change
case event := <-w.events:
case event, open := <-w.events:

return event, nil
}
}

func (w watchIntermediary) Send(e *workflowpkg.WorkflowWatchEvent) error {
w.events <- e
return nil
}

func newWatchIntermediary(ctx context.Context) *watchIntermediary {
return &watchIntermediary{newAbstractIntermediary(ctx), make(chan *workflowpkg.WorkflowWatchEvent)}
}