FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Move debug statement with blocking future.result() call to add_done_callback by jeffkpayne · Pull Request #4174 · googleapis/google-cloud-python · GitHub

Move debug statement with blocking future.result() call to add_done_callback - #4174

Merged
lukesneeringer merged 1 commit into
googleapis:masterfrom
bomboradata:master
Oct 13, 2017
Merged

Move debug statement with blocking future.result() call to add_done_callback#4174
lukesneeringer merged 1 commit into
googleapis:masterfrom
bomboradata:master

Conversation

jeffkpayne commented Oct 12, 2017
edited by tseaver
Loading

Copy link
Copy Markdown
Contributor

Closes #4167

googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 12, 2017
For each message, schedule a callback with the executor.
"""
def callback_completed(future):
logger.debug('Result: %s' % future.result())

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

tseaver added the api: pubsub Issues related to the Pub/Sub API. label Oct 13, 2017
tseaver changed the title PubSub: Move debug statement with blocking future.result() call to future.add_done_callback in thread-based subscriber Policy's on_response() Move debug statement with blocking future.result() call to add_done_callback Oct 13, 2017
lukesneeringer merged commit c171fdc into googleapis:master Oct 13, 2017

Copy link
Copy Markdown
Contributor

Thanks @jeffkpayne!

Copy link
Copy Markdown
Contributor Author

@lukesneeringer NP! Funny, though, I was just working on a unit test to test that the calls actually happen asynchronously... Should I continue with that and open a new PR?

Copy link
Copy Markdown
Contributor Author

It would be along the lines of:

def test_on_response():
    call_times = []

    def side_effect(*args, **kwargs):
        # list.append() is thread-safe.
        call_times.append(datetime.now())
        time.sleep(2)

    callback = mock.Mock(spec=())
    callback.side_effect = side_effect

    # Then, after the calls happen, test that the times are both more than a second ago, or something like that...

lukesneeringer commented Oct 13, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

I would accept that as a system test (but not a unit test). :-) And yes, additional PR is of course welcome.

Copy link
Copy Markdown
Contributor

P. S. pubsub 0.28.4 is going through CI to release now. (This was a serious enough bug that I wanted it out immediately.)

dhermes commented Oct 13, 2017

Copy link
Copy Markdown
Contributor

jeffkpayne added a commit to bomboradata/bombora-google-cloud-python that referenced this pull request Oct 14, 2017
jeffkpayne added a commit to bomboradata/bombora-google-cloud-python that referenced this pull request Oct 14, 2017
jeffkpayne added a commit to bomboradata/bombora-google-cloud-python that referenced this pull request Oct 14, 2017
…allbacks to complete. Guessing this test was succeeding before because of the bug fixed in googleapis#4174 itself.
tseaver pushed a commit that referenced this pull request Oct 17, 2017
parthea pushed a commit that referenced this pull request Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL