提交 f2b44e33 作者: Jeromy

rmeove duplicate timeout option from diag

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 075e6878
...@@ -85,7 +85,6 @@ that consume the dot format to generate graphs of the network. ...@@ -85,7 +85,6 @@ that consume the dot format to generate graphs of the network.
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.StringOption("timeout", "diagnostic timeout duration"),
cmds.StringOption("vis", "output vis. one of: "+strings.Join(visFmts, ", ")), cmds.StringOption("vis", "output vis. one of: "+strings.Join(visFmts, ", ")),
}, },
...@@ -122,7 +121,7 @@ that consume the dot format to generate graphs of the network. ...@@ -122,7 +121,7 @@ that consume the dot format to generate graphs of the network.
timeout = t timeout = t
} }
info, err := n.Diagnostics.GetDiagnostic(timeout) info, err := n.Diagnostics.GetDiagnostic(req.Context(), timeout)
if err != nil { if err != nil {
res.SetError(err, cmds.ErrNormal) res.SetError(err, cmds.ErrNormal)
return return
......
...@@ -134,9 +134,9 @@ func newID() string { ...@@ -134,9 +134,9 @@ func newID() string {
} }
// GetDiagnostic runs a diagnostics request across the entire network // GetDiagnostic runs a diagnostics request across the entire network
func (d *Diagnostics) GetDiagnostic(timeout time.Duration) ([]*DiagInfo, error) { func (d *Diagnostics) GetDiagnostic(ctx context.Context, timeout time.Duration) ([]*DiagInfo, error) {
log.Debug("Getting diagnostic.") log.Debug("Getting diagnostic.")
ctx, cancel := context.WithTimeout(context.TODO(), timeout) ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel() defer cancel()
diagID := newID() diagID := newID()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论