rmeove duplicate timeout option from diag
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jul 28, 2015 at 08:17 UTC
f2b44e3338b062b6f0996b129b17103546bb3b4b
2 files changed
+3
-4
core/commands/diag.go
+1
-2
@@ -85,7 +85,6 @@ that consume the dot format to generate graphs of the network.
85
},
86
87
Options: []cmds.Option{
88
- cmds.StringOption("timeout", "diagnostic timeout duration"),
88
cmds.StringOption("vis", "output vis. one of: "+strings.Join(visFmts, ", ")),
89
},
90
@@ -122,7 +121,7 @@ that consume the dot format to generate graphs of the network.
121
timeout = t
122
}
123
125
- info, err := n.Diagnostics.GetDiagnostic(timeout)
124
+ info, err := n.Diagnostics.GetDiagnostic(req.Context(), timeout)
125
if err != nil {
126
res.SetError(err, cmds.ErrNormal)
127
return
diagnostics/diag.go
+2
-2
@@ -134,9 +134,9 @@ func newID() string {
134
}
135
136
// 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) {
138
log.Debug("Getting diagnostic.")
139
- ctx, cancel := context.WithTimeout(context.TODO(), timeout)
139
+ ctx, cancel := context.WithTimeout(ctx, timeout)
140
defer cancel()
141
142
diagID := newID()