Skip to content

Commit 66a18da

Browse files
Matt LaPlantecopybara-github
authored andcommitted
Remove CreateTopic which causes errors in the cloud console once the topic exists.
Topics need only be created once, and can be created outside of the application during setup. PiperOrigin-RevId: 435676016
1 parent 3aa2ccb commit 66a18da

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

appengine/endpoints/request.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"math/rand"
2727
"net/http"
2828
"os"
29-
"strings"
3029
"time"
3130

3231
"google.golang.org/appengine"
@@ -310,13 +309,6 @@ func publishRequest(ctx context.Context, reqID string) error {
310309
return fmt.Errorf("pubsub.NewClient(%q) returned: %v", envProject, err)
311310
}
312311

313-
// Create topic if it doesn't exist.
314-
_, err = ps.CreateTopic(ctx, envTopic)
315-
if err != nil && !strings.Contains(err.Error(), "AlreadyExists") {
316-
return fmt.Errorf("failed to create topic %q: %v", envTopic, err)
317-
}
318-
319-
// CreateTopic doesn't return the topic if it already exists
320312
topic := ps.Topic(envTopic)
321313
defer topic.Stop()
322314
res := topic.Publish(ctx, &pubsub.Message{Data: []byte(reqID)})

0 commit comments

Comments
 (0)