Skip to content

Commit f2b44e3

Browse files
committedJul 28, 2015
rmeove duplicate timeout option from diag
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 075e687 commit f2b44e3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
 

‎core/commands/diag.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ that consume the dot format to generate graphs of the network.
8585
},
8686

8787
Options: []cmds.Option{
88-
cmds.StringOption("timeout", "diagnostic timeout duration"),
8988
cmds.StringOption("vis", "output vis. one of: "+strings.Join(visFmts, ", ")),
9089
},
9190

@@ -122,7 +121,7 @@ that consume the dot format to generate graphs of the network.
122121
timeout = t
123122
}
124123

125-
info, err := n.Diagnostics.GetDiagnostic(timeout)
124+
info, err := n.Diagnostics.GetDiagnostic(req.Context(), timeout)
126125
if err != nil {
127126
res.SetError(err, cmds.ErrNormal)
128127
return

‎diagnostics/diag.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ func newID() string {
134134
}
135135

136136
// GetDiagnostic runs a diagnostics request across the entire network
137-
func (d *Diagnostics) GetDiagnostic(timeout time.Duration) ([]*DiagInfo, error) {
137+
func (d *Diagnostics) GetDiagnostic(ctx context.Context, timeout time.Duration) ([]*DiagInfo, error) {
138138
log.Debug("Getting diagnostic.")
139-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
139+
ctx, cancel := context.WithTimeout(ctx, timeout)
140140
defer cancel()
141141

142142
diagID := newID()

0 commit comments

Comments
 (0)
Please sign in to comment.