GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PubSub JSON Double base64 Encode · Issue #2771 · googleapis/google-cloud-python

PubSub JSON Double base64 Encode  #2771

New issue
Copy link
New issue
Copy link
Closed
Closed
PubSub JSON Double base64 Encode #2771
Copy link
Assignees
daspecster
Labels
api: pubsubIssues related to the Pub/Sub API.

Description

@HakShak
HakShak
opened on Nov 24, 2016
Issue body actions

We recently upgraded from 0.18.1 to 0.21.0 and we do not use gRPC/GAX/Protobuf fun times, but we use the JSONPublisherApi.

Maybe we are using the topic.Batch().Commit() method wrong, but we have been using it in our retry strategy to just simply call Commit() again.

With the change in #2577 it seems that Commit() will double encode if you just call Commit() again on a network failure.

Is this the intended design? Are we supposed to keep another copy of the message batch or create another message batch?

Activity

  1. dhermes
    added
    api: pubsubIssues related to the Pub/Sub API.
    on Nov 24, 2016
  2. dhermes commented on Nov 24, 2016

    @dhermes
    dhermes
    on Nov 24, 2016
    Contributor
    More actions

    @HakShak You reference "the change in #2577" but that was actually a bug report of this same issue, which presumably was fixed in #2578. Can you give a snippet of code showing the issue?

  3. HakShak commented on Nov 24, 2016

    @HakShak
    HakShak
    on Nov 24, 2016
    Author
    More actions
    topic_batch = topic.batch()
    topic_batch.publish(somedata, someattributes)
    
    try:
        topic_batch.commit()
    except NetworkErrorOfSomeKind:
        topic_batch.commit()
    # Imagine a proper retry loop here.

    Ultimately this: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/0.18.1/gcloud/pubsub/topic.py#L442

    Changed to this: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/pubsub/google/cloud/pubsub/_http.py#L206

    The base64 encoding was done on Batch.Publish(), but now is done in Batch.Commit()

  4. daspecster commented on Nov 25, 2016

    @daspecster
    daspecster
    on Nov 25, 2016
    Contributor
    More actions

    I can test this more later on today.

    We could return a copy of the messages from _transform_messages_base64(), instead of editing them in place, or we might have to flag the messages that are encoded already.

  5. daspecster
    self-assigned this
    on Nov 25, 2016
  6. HakShak commented on Nov 25, 2016

    @HakShak
    HakShak
    on Nov 25, 2016
    Author
    More actions

    We ended up copying the Batch.messages before trying commit. The flag seems more "efficient".

  7. daspecster
    closed this as completedin #2773on Nov 29, 2016
  8. theacodes
    unassigned
    daspecster
    on Sep 28, 2018
  9. JustinBeckwith
    assigned
    daspecster
    on Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @daspecster
    daspecster

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.