Skip to content

Commit

Permalink
Move debug logging call in Future.add_done_callback (#4167)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkpayne committed Oct 12, 2017
1 parent e1a2483 commit 4c86521
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
logger = logging.getLogger(__name__)


def _callback_completed(future):
"""Simple callback that just logs a `Future`'s result."""
logger.debug('Result: %s', future.result())


class Policy(base.BasePolicy):
"""A consumer class based on :class:`threading.Thread`.
Expand Down Expand Up @@ -144,4 +149,4 @@ def on_response(self, response):
logger.debug(self._callback)
message = Message(msg.message, msg.ack_id, self._request_queue)
future = self._executor.submit(self._callback, message)
logger.debug('Result: %s' % future.result())
future.add_done_callback(_callback_completed)

0 comments on commit 4c86521

Please sign in to comment.