Skip to content

Commit c738df5

Browse files
committed
Small Updates
Changes ======= * Ignore potential extra details from network_stream extra details (specifically when working with IPv6) * Add log message to indicate when sync API is creating and shutting down ThreadPoolExecutor * Update windows script in verify_release workflow
1 parent bd9a8b6 commit c738df5

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/verify_release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ jobs:
451451
dir
452452
python -m pip install -r requirements-test.txt
453453
echo "INSTALL_CMD=$env:INSTALL_CMD"
454-
PIP_CMD="python -m pip $($env:INSTALL_CMD) couchbase-analytics==$($env:SDK_VERSION)"
454+
$PIP_CMD="python -m pip $($env:INSTALL_CMD) couchbase-analytics==$($env:SDK_VERSION)"
455+
iex $PIP_CMD
455456
python -m pip list
456457
$TEST_ACOUCHBASE_API="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_acouchbase_api }}"
457458
if ( $TEST_ACOUCHBASE_API -eq "true" ) {

couchbase_analytics/common/_core/error_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def update_request_context(self, request: QueryRequest) -> None:
5656
def update_response_context(self, response: HttpCoreResponse) -> None:
5757
network_stream = response.extensions.get('network_stream', None)
5858
if network_stream is not None:
59-
addr, port = network_stream.get_extra_info('client_addr')
59+
addr, port, *_ = network_stream.get_extra_info('client_addr')
6060
self.last_dispatched_from = f'{addr}:{port}'
61-
addr, port = network_stream.get_extra_info('server_addr')
61+
addr, port, *_ = network_stream.get_extra_info('server_addr')
6262
self.last_dispatched_to = f'{addr}:{port}'
6363
self.status_code = response.status_code
6464

couchbase_analytics/protocol/cluster.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ def __init__(
4646
# The RequestContext generates a future that enables some background processing
4747
# Allow the default max_workers which is (as of Python 3.8): min(32, os.cpu_count() + 4).
4848
# We can add an option later if we see a need
49-
self._tp_executor = ThreadPoolExecutor()
49+
self._tp_executor_prefix = f'pycbac-tpe-{self._cluster_id[:8]}'
50+
self._tp_executor = ThreadPoolExecutor(thread_name_prefix=self._tp_executor_prefix)
51+
self._client_adapter.log_message(
52+
f'Created ThreadPoolExecutor({self._tp_executor_prefix})', LogLevel.INFO
53+
)
5054
self._tp_executor_shutdown_called = False
5155
atexit.register(self._shutdown_executor)
5256

@@ -84,8 +88,7 @@ def _shutdown(self) -> None:
8488
"""
8589
self._client_adapter.close_client()
8690
self._client_adapter.reset_client()
87-
if self._tp_executor_shutdown_called is False:
88-
self._tp_executor.shutdown()
91+
self._shutdown_executor()
8992

9093
def _create_client(self) -> None:
9194
"""
@@ -95,6 +98,9 @@ def _create_client(self) -> None:
9598

9699
def _shutdown_executor(self) -> None:
97100
if self._tp_executor_shutdown_called is False:
101+
self._client_adapter.log_message(
102+
f'Shutting down ThreadPoolExecutor({self._tp_executor_prefix})', LogLevel.INFO
103+
)
98104
self._tp_executor.shutdown()
99105
self._tp_executor_shutdown_called = True
100106

0 commit comments

Comments
 (0)