Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: jyjiangkai <jyjiangkai@163.com>
  • Loading branch information
hwjiangkai committed Mar 27, 2023
1 parent 23dcb26 commit fd80137
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/examples/eventbus/append/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {
if err != nil {
panic("invalid id")
}
bus, err := c.Eventbus(ctx, api.WithName("quick-start"), api.WithID(eventbusID.Uint64()))
bus, err := c.Eventbus(ctx, api.WithID(eventbusID.Uint64()))
if err != nil {
panic(err.Error())
}
Expand Down
6 changes: 6 additions & 0 deletions client/pkg/eventbus/eventbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ func (w *busWriter) pickWritableLog(ctx context.Context, opts *api.WriteOptions)
if err != nil {
return nil, err
}
if lw == nil {
return nil, errors.ErrResourceCanNotOp.WithMessage("can not pick writable log")
}

return lw.Writer(), nil
}
Expand Down Expand Up @@ -588,6 +591,9 @@ func (r *busReader) pickReadableLog(ctx context.Context, opts *api.ReadOptions)
if err != nil {
return nil, err
}
if lr == nil {
return nil, errors.ErrResourceCanNotOp.WithMessage("can not pick readable log")
}

return lr.Reader(eventlog.ReaderConfig{PollingTimeout: opts.PollingTimeout}), nil
}

0 comments on commit fd80137

Please sign in to comment.