@@ -8,14 +8,11 @@ import (
88 "log"
99 "net/http"
1010 "os"
11- "os/exec"
1211 "runtime"
1312 "strconv"
1413 "sync/atomic"
1514 "time"
1615
17- "google.golang.org/api/option"
18-
1916 "cloud.google.com/go/pubsub"
2017 "golang.org/x/net/context"
2118
@@ -258,22 +255,12 @@ func setMaxInFlight() {
258255}
259256
260257func runPubSubHandler () error {
261- keybucket := os .Getenv ("SUBSCRIPTION_KEY_BUCKET" )
262- keyfile := os .Getenv ("SUBSCRIPTION_KEY_FILE" )
263- cmd := exec .Command ("gsutil" , "cp" , keybucket + keyfile , "/tmp/" + keyfile )
264- stdoutStderr , err := cmd .CombinedOutput ()
265- if err != nil {
266- log .Println (stdoutStderr )
267- return err
268- }
269-
270258 ctx := context .Background ()
271- opt := option .WithServiceAccountFile ("/tmp/" + keyfile )
272259 // Must use the project where the subscription resides, or else
273260 // we can't find it.
274261 proj := os .Getenv ("SUBSCRIPTION_PROJECT" )
275262 subscription := os .Getenv ("SUBSCRIPTION_NAME" )
276- client , err := pubsub .NewClient (ctx , proj , opt )
263+ client , err := pubsub .NewClient (ctx , proj )
277264
278265 if err != nil {
279266 return err
@@ -318,7 +305,7 @@ func runPubSubHandler() error {
318305 log .Println (outcome )
319306 // TODO(gfr) Remove once we it looks ok.
320307 msg .Nack ()
321- time .Sleep (30 * time .Second )
308+ time .Sleep (30 * time .Second )
322309 } else {
323310 msg .Ack ()
324311 }
0 commit comments