Skip to content

Commit

Permalink
Don't timeout users entering OAuth info (google#1195)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbelvin committed Feb 8, 2019
1 parent 25eae20 commit 5ac39fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/keytransparency-client/cmd/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ User email MUST match the OAuth account used to authorize the update.
return fmt.Errorf("hex.Decode(%v): %v", data, err)
}
userID := args[0]
timeout := viper.GetDuration("timeout")
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
ctx := context.Background()

// Create client.
userCreds, err := userCreds(ctx)
Expand Down Expand Up @@ -107,7 +105,10 @@ User email MUST match the OAuth account used to authorize the update.
PublicKeyData: profileData,
AuthorizedKeys: authorizedKeys.Keyset(),
}
if _, err := c.Update(ctx, u, []tink.Signer{signer},
timeout := viper.GetDuration("timeout")
cctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
if _, err := c.Update(cctx, u, []tink.Signer{signer},
grpc.PerRPCCredentials(userCreds)); err != nil {
return fmt.Errorf("update failed: %v", err)
}
Expand Down

0 comments on commit 5ac39fe

Please sign in to comment.