Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 65cb048

Browse files
committedMay 22, 2019
pluggable discovery: Fixed timeout for LIST to 2 seconds
1 parent 8b3143c commit 65cb048

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎arduino/discovery/discovery.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ type Discovery struct {
3737
out io.ReadCloser
3838
outJSON *json.Decoder
3939
cmd *exec.Cmd
40-
Timeout time.Duration
4140
}
4241

4342
// BoardPort is a generic port descriptor
@@ -61,9 +60,7 @@ func NewFromCommandLine(args ...string) (*Discovery, error) {
6160
if err != nil {
6261
return nil, fmt.Errorf("creating discovery process: %s", err)
6362
}
64-
disc := &Discovery{Timeout: time.Second}
65-
disc.cmd = cmd
66-
return disc, nil
63+
return &Discovery{cmd: cmd}, nil
6764
}
6865

6966
// Start starts the specified discovery
@@ -96,7 +93,7 @@ func (d *Discovery) List() ([]*BoardPort, error) {
9693
go func() {
9794
select {
9895
case <-done:
99-
case <-time.After(d.Timeout):
96+
case <-time.After(2000 * time.Millisecond):
10097
timeout = true
10198
d.Close()
10299
}

0 commit comments

Comments
 (0)
Please sign in to comment.