Skip to content

Commit

Permalink
Renaming "Consumer helper" threads in Pub/Sub. (googleapis#4476)
Browse files Browse the repository at this point in the history
Now names will show up in logs as

  Thread-ConsumerHelper-CallbackRequestsWorker
  Thread-ConsumerHelper-ConsumeBidirectionalStream

instead of as

  Consumer helper: callback requests worker
  Consumer helper: consume bidirectional stream
  • Loading branch information
dhermes authored Nov 29, 2017
1 parent 667e197 commit 5f059f0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pubsub/google/cloud/pubsub_v1/subscriber/_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def start_consuming(self):
self.active = True
self._exiting.clear()
self.helper_threads.start(
'consume bidirectional stream',
'ConsumeBidirectionalStream',
self._request_queue,
self._blocking_consume,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def start(self, name, queue, target, *args, **kwargs):
"""
# Create and start the helper thread.
thread = threading.Thread(
name='Consumer helper: {}'.format(name),
name='Thread-ConsumerHelper-{}'.format(name),
target=target,
*args,
**kwargs
Expand Down
2 changes: 1 addition & 1 deletion pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def open(self, callback):
_LOGGER.debug('Starting callback requests worker.')
self._callback = callback
self._consumer.helper_threads.start(
'callback requests worker',
'CallbackRequestsWorker',
self._request_queue,
self._callback_requests,
)
Expand Down
2 changes: 1 addition & 1 deletion pubsub/tests/unit/pubsub_v1/subscriber/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_start_consuming():
assert consumer._exiting.is_set() is False
assert consumer.active is True
start.assert_called_once_with(
'consume bidirectional stream',
'ConsumeBidirectionalStream',
consumer._request_queue,
consumer._blocking_consume,
)

0 comments on commit 5f059f0

Please sign in to comment.