Skip to content

Commit 93e3cb3

Browse files
committed
FIX: Fixed inconsistent c++ method implementation, removed unnecessary TODO
1 parent 031cf47 commit 93e3cb3

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/client.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ Consumer Client_subscribe_topics(Client& client, const std::vector<std::string>&
5555
}
5656

5757
void Client_subscribe_topicsAsync(Client& client, const std::vector<std::string>& topics, const std::string& subscriptionName, const ConsumerConfiguration& conf, SubscribeCallback callback){
58-
client.subscribeAsync(topics, subscriptionName, conf, [callback](Result result, pulsar::Consumer consumer){
59-
callback(result, consumer);
60-
});
58+
py::gil_scoped_release release;
59+
client.subscribeAsync(topics, subscriptionName, conf, callback);
6160
}
6261

6362
Consumer Client_subscribe_pattern(Client& client, const std::string& topic_pattern,
@@ -68,10 +67,8 @@ Consumer Client_subscribe_pattern(Client& client, const std::string& topic_patte
6867
}
6968

7069
void Client_subscribe_patternAsync(Client& client, const std::string& topic_pattern, const std::string& subscriptionName, const ConsumerConfiguration& conf, SubscribeCallback callback){
71-
client.subscribeWithRegexAsync(topic_pattern, subscriptionName, conf, [callback](Result result, Consumer consumer){
72-
py::gil_scoped_acquire acquire;
73-
callback(result, consumer);
74-
});
70+
py::gil_scoped_release release;
71+
client.subscribeWithRegexAsync(topic_pattern, subscriptionName, conf, callback);
7572
}
7673

7774
Reader Client_createReader(Client& client, const std::string& topic, const MessageId& startMessageId,

src/consumer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* distributed with this work for additional information
55
* regarding copyright ownership. The ASF licenses this file
66
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except
7+
* "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
99
*
1010
* http://www.apache.org/licenses/LICENSE-2.0

tests/asyncio_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
IsolatedAsyncioTestCase,
3535
)
3636

37-
# TODO: Write tests for everything else
38-
3937
service_url = 'pulsar://localhost'
4038

4139
class AsyncioTest(IsolatedAsyncioTestCase):
@@ -68,7 +66,7 @@ async def test_create_producer_failure(self):
6866
await self._client.create_producer('tenant/ns/awaitio-test-send-failure')
6967
self.fail()
7068
except PulsarException as e:
71-
self.assertEqual(e.error(), pulsar.Result.Timeout)
69+
self.assertEqual(e.error(), pulsar.Result.TopicNotFound)
7270

7371
async def test_send_failure(self):
7472
producer = await self._client.create_producer('awaitio-test-send-failure')

0 commit comments

Comments
 (0)