File tree Expand file tree Collapse file tree 5 files changed +19
-4
lines changed Expand file tree Collapse file tree 5 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ require (
23
23
github.com/spf13/pflag v1.0.5
24
24
github.com/stretchr/testify v1.9.0
25
25
github.com/tj/go-spin v1.1.0
26
- github.com/usrbinapp/usrbin-go v0.0.6-0.20240528182947-97f4d679ee25
26
+ github.com/usrbinapp/usrbin-go v0.0.6
27
27
golang.org/x/crypto v0.23.0
28
28
golang.org/x/term v0.20.0
29
29
gopkg.in/yaml.v3 v3.0.1
Original file line number Diff line number Diff line change @@ -1062,6 +1062,8 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
1062
1062
github.com/ulikunitz/xz v0.5.11 /go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14 =
1063
1063
github.com/usrbinapp/usrbin-go v0.0.6-0.20240528182947-97f4d679ee25 h1:Mkrm0tKAMebM0G05L0khgw3xyLziJqy3/tGvfu+qPMs =
1064
1064
github.com/usrbinapp/usrbin-go v0.0.6-0.20240528182947-97f4d679ee25 /go.mod h1:gDtvVf9mVkeVfWj4Oa4Ur4uZQOv9TXPfoKgwnLUbbic =
1065
+ github.com/usrbinapp/usrbin-go v0.0.6 h1:B+LpBK1AT3SI6oH8BjR0z+rnYpVhpml2ZbN5wsXs7Gk =
1066
+ github.com/usrbinapp/usrbin-go v0.0.6 /go.mod h1:gDtvVf9mVkeVfWj4Oa4Ur4uZQOv9TXPfoKgwnLUbbic =
1065
1067
github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts =
1066
1068
github.com/vbatts/tar-split v0.11.5 /go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk =
1067
1069
github.com/vmware-tanzu/velero v1.13.2 h1:72Rw+11HJB6XUYfH9/M/jle6duSLyGhMisMMYFr/1qs =
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
)
13
13
14
14
const (
15
- cacheTTLInHours = 4
15
+ cacheTTLInMinutes = 15
16
16
17
17
replicatedDir = ".replicated"
18
18
cacheFile = "cache.json"
@@ -53,7 +53,7 @@ func (c *cache) IsUpdateCheckerInfoExpired(currentVersion string) bool {
53
53
return true
54
54
}
55
55
56
- if c .UpdateCheckerInfo .CheckedAt .Add (time .Duration (cacheTTLInHours ) * time .Hour ).Before (time .Now ()) {
56
+ if c .UpdateCheckerInfo .CheckedAt .Add (time .Duration (cacheTTLInMinutes ) * time .Minute ).Before (time .Now ()) {
57
57
return true
58
58
}
59
59
Original file line number Diff line number Diff line change 1
1
package version
2
2
3
- import "github.com/usrbinapp/usrbin-go"
3
+ import (
4
+ "time"
5
+
6
+ "github.com/usrbinapp/usrbin-go"
7
+ )
4
8
5
9
func NewUsrbinSDK (currentVersion string ) (* usrbin.SDK , error ) {
6
10
return usrbin .New (
7
11
currentVersion ,
8
12
usrbin .UsingGitHubUpdateChecker ("github.com/replicatedhq/replicated" ),
9
13
usrbin .UsingHomebrewFormula ("replicatedhq/replicated/cli" ),
14
+ usrbin .UsingHttpTimeout (time .Second ),
10
15
)
11
16
}
Original file line number Diff line number Diff line change 6
6
"runtime"
7
7
"time"
8
8
9
+ "github.com/pkg/errors"
9
10
"github.com/replicatedhq/replicated/pkg/replicatedfile"
11
+ usrbingithub "github.com/usrbinapp/usrbin-go/pkg/github"
10
12
"github.com/usrbinapp/usrbin-go/pkg/updatechecker"
11
13
)
12
14
@@ -57,6 +59,12 @@ func initBuild() {
57
59
58
60
build .UpdateInfo , err = usrbinsdk .GetUpdateInfo ()
59
61
if err != nil {
62
+ if errors .Cause (err ) == usrbingithub .ErrTimeoutExceeded {
63
+ // i'm going to leave this println out for now because it could be really noisy
64
+ // for someone with a slow connection
65
+ // fmt.Fprintln(os.Stderr, "Unable to check for updates, timeout exceeded.")
66
+ return
67
+ }
60
68
fmt .Fprintf (os .Stderr , "Error getting update info: %s" , err )
61
69
}
62
70
You can’t perform that action at this time.
0 commit comments