Skip to content

Commit 879cdfd

Browse files
Bump C++ client to 4.0.0 (#273)
1 parent 60bc8c0 commit 879cdfd

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ message(STATUS "PULSAR_LIBRARY: ${PULSAR_LIBRARY}")
4848
find_path(PULSAR_INCLUDE pulsar/Client.h)
4949
message(STATUS "PULSAR_INCLUDE: ${PULSAR_INCLUDE}")
5050

51-
SET(CMAKE_CXX_STANDARD 11)
51+
SET(CMAKE_CXX_STANDARD 17)
5252

5353
find_package (Python3 REQUIRED COMPONENTS Development.Module)
5454
MESSAGE(STATUS "PYTHON: " ${Python3_VERSION} " - " ${Python3_INCLUDE_DIRS})

dependencies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# under the License.
1818
#
1919

20-
pulsar-cpp: 3.8.0
20+
pulsar-cpp: 4.0.0
2121
pybind11: 2.10.1
2222
# The OpenSSL dependency is only used when building Python from source
2323
openssl: 1.1.1q

tests/custom_logger_test.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from unittest import TestCase, main
2222
import asyncio
2323
import logging
24+
import threading
2425
from pulsar import Client
2526

2627
class CustomLoggingTest(TestCase):
@@ -49,6 +50,35 @@ async def async_get(value):
4950

5051
client.close()
5152

53+
def test_logger_thread_leaks(self):
54+
def _do_connect(close):
55+
logger = logging.getLogger(str(threading.current_thread().ident))
56+
logger.setLevel(logging.INFO)
57+
client = Client(
58+
service_url="pulsar://localhost:6650",
59+
io_threads=4,
60+
message_listener_threads=4,
61+
operation_timeout_seconds=1,
62+
log_conf_file_path=None,
63+
authentication=None,
64+
logger=logger,
65+
)
66+
client.get_topic_partitions("persistent://public/default/partitioned_topic_name_test")
67+
if close:
68+
client.close()
69+
70+
for should_close in (True, False):
71+
self.assertEqual(threading.active_count(), 1, "Explicit close: {}; baseline is 1 thread".format(should_close))
72+
_do_connect(should_close)
73+
self.assertEqual(threading.active_count(), 1, "Explicit close: {}; synchronous connect doesn't leak threads".format(should_close))
74+
threads = []
75+
for _ in range(10):
76+
threads.append(threading.Thread(target=_do_connect, args=(should_close)))
77+
threads[-1].start()
78+
for thread in threads:
79+
thread.join()
80+
assert threading.active_count() == 1, "Explicit close: {}; threaded connect in parallel doesn't leak threads".format(should_close)
81+
5282
if __name__ == '__main__':
5383
logging.basicConfig(level=logging.DEBUG)
5484
main()

tests/pulsar_test.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121

2222
import random
23-
import threading
24-
import logging
2523
from typing import Optional
2624
from unittest import TestCase, main
2725
import time
@@ -1529,34 +1527,6 @@ def test_json_schema_encode(self):
15291527
self.assertEqual(first_encode, second_encode)
15301528

15311529

1532-
def test_logger_thread_leaks(self):
1533-
def _do_connect(close):
1534-
logger = logging.getLogger(str(threading.current_thread().ident))
1535-
logger.setLevel(logging.INFO)
1536-
client = pulsar.Client(
1537-
service_url="pulsar://localhost:6650",
1538-
io_threads=4,
1539-
message_listener_threads=4,
1540-
operation_timeout_seconds=1,
1541-
log_conf_file_path=None,
1542-
authentication=None,
1543-
logger=logger,
1544-
)
1545-
client.get_topic_partitions("persistent://public/default/partitioned_topic_name_test")
1546-
if close:
1547-
client.close()
1548-
1549-
for should_close in (True, False):
1550-
self.assertEqual(threading.active_count(), 1, "Explicit close: {}; baseline is 1 thread".format(should_close))
1551-
_do_connect(should_close)
1552-
self.assertEqual(threading.active_count(), 1, "Explicit close: {}; synchronous connect doesn't leak threads".format(should_close))
1553-
threads = []
1554-
for _ in range(10):
1555-
threads.append(threading.Thread(target=_do_connect, args=(should_close)))
1556-
threads[-1].start()
1557-
for thread in threads:
1558-
thread.join()
1559-
assert threading.active_count() == 1, "Explicit close: {}; threaded connect in parallel doesn't leak threads".format(should_close)
15601530

15611531
def test_chunking(self):
15621532
client = Client(self.serviceUrl)

0 commit comments

Comments
 (0)