| Index: client/swarming/swarming.go
|
| diff --git a/client/swarming/swarming.go b/client/swarming/swarming.go
|
| index 81c68cba34d2dd2473bb674da192265c793b3b86..19c7856627819844e7f5a1fb49be3bc5673b2244 100644
|
| --- a/client/swarming/swarming.go
|
| +++ b/client/swarming/swarming.go
|
| @@ -10,7 +10,8 @@ import (
|
| "strings"
|
| "time"
|
|
|
| - "github.com/luci/luci-go/client/internal/common"
|
| + "github.com/luci/luci-go/client/internal/lhttp"
|
| + "github.com/luci/luci-go/client/internal/retry"
|
| )
|
|
|
| // TaskID is a unique reference to a Swarming task.
|
| @@ -18,25 +19,20 @@ type TaskID string
|
|
|
| // Swarming defines a Swarming client.
|
| type Swarming struct {
|
| - host string
|
| - client *http.Client
|
| + host string
|
| }
|
|
|
| func (s *Swarming) getJSON(resource string, v interface{}) error {
|
| if len(resource) == 0 || resource[0] != '/' {
|
| return errors.New("resource must start with '/'")
|
| }
|
| - status, err := common.GetJSON(s.client, s.host+resource, v)
|
| - if status == http.StatusNotFound {
|
| - return errors.New("not found")
|
| - }
|
| - return err
|
| + return lhttp.GetJSON(retry.Default, http.DefaultClient, s.host+resource, v)
|
| }
|
|
|
| // NewSwarming returns a new Swarming client.
|
| func New(host string) (*Swarming, error) {
|
| host = strings.TrimRight(host, "/")
|
| - return &Swarming{host, http.DefaultClient}, nil
|
| + return &Swarming{host}, nil
|
| }
|
|
|
| // FetchRequest returns the TaskRequest.
|
|
|