Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: logdog/appengine/coordinator/service.go

Issue 2582253002: logdog: Use gRPC credentials when creating PubSub client, not http.Client. (Closed)
Patch Set: clear gRPC metadata as a precation Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « logdog/appengine/coordinator/mutations/createArchiveTask.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/appengine/coordinator/service.go
diff --git a/logdog/appengine/coordinator/service.go b/logdog/appengine/coordinator/service.go
index cc9a9eef6c61af9469cf396b67d99b69b9df35fa..df652662587b1c9236a8a95a16a34c2756a62d37 100644
--- a/logdog/appengine/coordinator/service.go
+++ b/logdog/appengine/coordinator/service.go
@@ -5,7 +5,6 @@
package coordinator
import (
- "net/http"
"sync"
"sync/atomic"
"time"
@@ -331,19 +330,22 @@ func (s *prodServicesInst) ArchivalPublisher(c context.Context) (ArchivalPublish
project, topic := fullTopic.Split()
// Create an authenticated Pub/Sub client.
- transport, err := auth.GetRPCTransport(c, auth.AsSelf, auth.WithScopes(pubsub.PublisherScopes...))
+ creds, err := auth.GetPerRPCCredentials(auth.AsSelf, auth.WithScopes(pubsub.PublisherScopes...))
if err != nil {
- log.WithError(err).Errorf(c, "Failed to create Pub/Sub authenticator.")
- return nil, errors.New("failed to create Pub/Sub authenticator")
+ log.WithError(err).Errorf(c, "Failed to create Pub/Sub credentials.")
+ return nil, errors.New("failed to create Pub/Sub credentials")
}
- client := &http.Client{Transport: transport}
- psClient, err := gcps.NewClient(c, project, option.WithHTTPClient(client))
+ // Don't pass gRPC metadata to PubSub.
+ psClient, err := gcps.NewClient(
+ metadata.NewContext(c, nil), project,
+ option.WithGRPCDialOption(grpc.WithPerRPCCredentials(creds)))
if err != nil {
log.WithError(err).Errorf(c, "Failed to create Pub/Sub client.")
return nil, errors.New("failed to create Pub/Sub client")
}
return &pubsubArchivalPublisher{
+ client: psClient,
topic: psClient.Topic(topic),
publishIndexFunc: s.nextArchiveIndex,
}, nil
« no previous file with comments | « logdog/appengine/coordinator/mutations/createArchiveTask.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698