Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
Log sink pipe errors from write (#427)
Browse files Browse the repository at this point in the history
Also add back a commented-out write error test for pipeline

fixes #426
  • Loading branch information
johnnason authored and jipperinbham committed Dec 12, 2017
1 parent c272423 commit 49805a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
3 changes: 3 additions & 0 deletions pipeline/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ func (n *Node) write(msg message.Msg, off offset.Offset) (message.Msg, error) {
c := make(chan writeResult)
go func() {
m, err := client.Write(n.c, n.writer, msg)
if err != nil {
n.l.Errorf("write error, %s", err)
}
c <- writeResult{m, err}
}()
select {
Expand Down
43 changes: 22 additions & 21 deletions pipeline/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,28 @@ var (
},
client.ErrMockConnect,
},
// uncomment this once the error handling mess is sorted out
// {
// func() *Node {
// a := &adaptor.Mock{}
// n, _ := NewNodeWithOptions(
// "starter", "stopWriter", defaultNsString,
// WithClient(a),
// WithReader(a),
// WithCommitLog("testdata/restart_from_end", 1024),
// )
// NewNodeWithOptions(
// "stopperWriteErr", "stopWriter", defaultNsString,
// WithClient(a),
// WithWriter(&adaptor.MockWriterErr{}),
// WithParent(n),
// WithOffsetManager(&offset.MockManager{MemoryMap: map[string]uint64{}}),
// )
// return n
// },
// client.ErrMockWrite,
// },
{
func() *Node {
a := &adaptor.Mock{}
n, _ := NewNodeWithOptions(
"starter", "stopWriter", defaultNsString,
WithClient(a),
WithReader(a),
WithCommitLog([]commitlog.OptionFunc{
commitlog.WithPath("testdata/pipeline_run"),
}...),
)
NewNodeWithOptions(
"stopperWriteErr", "stopWriter", defaultNsString,
WithClient(a),
WithWriter(&adaptor.MockWriterErr{}),
WithParent(n),
WithOffsetManager(&offset.MockManager{MemoryMap: map[string]uint64{}}),
)
return n
},
client.ErrMockWrite,
},
}
)

Expand Down

0 comments on commit 49805a9

Please sign in to comment.