Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 5538af6

Browse files
committed
Add context to sync.Version.
1 parent f745670 commit 5538af6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/sync/sync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ const (
266266
// Returns remote protocol version as a string.
267267
// Or, an error if one exists.
268268
func (s Sync) Version() (string, error) {
269+
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
270+
defer cancel()
271+
269272
conn, err := s.Client.DialWsep(ctx, s.Env)
270273
if err != nil {
271274
return "", err
272275
}
273276
defer conn.Close(websocket.CloseNormalClosure, "")
274277

275-
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
276-
defer cancel()
277-
278278
execer := wsep.RemoteExecer(conn)
279279
process, err := execer.Start(ctx, wsep.Command{
280280
Command: "rsync",

0 commit comments

Comments
 (0)