wspr: Remove the redundant With* methods on context.
Change-Id: Id935c7b108c3787b8b3a07caa7837d342253658e
MultiPart: 2/4
diff --git a/services/wsprd/account/account.go b/services/wsprd/account/account.go
index fc9567c..acba958 100644
--- a/services/wsprd/account/account.go
+++ b/services/wsprd/account/account.go
@@ -55,7 +55,7 @@
func (am *AccountManager) CreateAccount(accessToken string) (string, error) {
// Get a blessing for the access token from blessing server.
- ctx, cancel := am.rt.NewContext().WithTimeout(time.Minute)
+ ctx, cancel := context.WithTimeout(am.rt.NewContext(), time.Minute)
defer cancel()
blessings, account, err := am.blesser.BlessUsingAccessToken(ctx, accessToken)
if err != nil {
diff --git a/services/wsprd/app/app.go b/services/wsprd/app/app.go
index a75cefd..3421ab7 100644
--- a/services/wsprd/app/app.go
+++ b/services/wsprd/app/app.go
@@ -387,9 +387,9 @@
// However as a rollout strategy we must, otherwise there is a circular
// dependency between the WSPR change and the JS change that will follow.
if msg.Timeout == lib.JSIPCNoTimeout || msg.Timeout == 0 {
- cctx, cancel = ctx.WithCancel()
+ cctx, cancel = context.WithCancel(ctx)
} else {
- cctx, cancel = ctx.WithTimeout(lib.JSToGoDuration(msg.Timeout))
+ cctx, cancel = context.WithTimeout(ctx, lib.JSToGoDuration(msg.Timeout))
}
request := &outstandingRequest{