Skip to content

Commit 342505e

Browse files
committed
pass by value + std::move for better performance
1 parent e70a0a4 commit 342505e

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

include/pulsar/Client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class PULSAR_PUBLIC Client {
429429
*
430430
* @param serviceInfo the service URL, authentication and TLS trust certs file path to use
431431
*/
432-
void updateServiceInfo(const ServiceInfo& serviceInfo);
432+
void updateServiceInfo(ServiceInfo serviceInfo);
433433

434434
/**
435435
* Get the current service information of the client.

lib/Client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void Client::getSchemaInfoAsync(const std::string& topic, int64_t version,
198198
.addListener(std::move(callback));
199199
}
200200

201-
void Client::updateServiceInfo(const ServiceInfo& serviceInfo) { impl_->updateServiceInfo(serviceInfo); }
201+
void Client::updateServiceInfo(ServiceInfo serviceInfo) { impl_->updateServiceInfo(std::move(serviceInfo)); }
202202

203203
ServiceInfo Client::getServiceInfo() const { return impl_->getServiceInfo(); }
204204

lib/ClientImpl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ std::chrono::nanoseconds ClientImpl::getOperationTimeout(const ClientConfigurati
880880
return clientConfiguration.impl_->operationTimeout;
881881
}
882882

883-
void ClientImpl::updateServiceInfo(const ServiceInfo& serviceInfo) {
883+
void ClientImpl::updateServiceInfo(ServiceInfo&& serviceInfo) {
884884
std::unique_lock lock(mutex_);
885885
if (state_ != Open) {
886886
LOG_ERROR("Client is not open, cannot update connection info");

lib/ClientImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ClientImpl : public std::enable_shared_from_this<ClientImpl> {
140140
ConnectionPool& getConnectionPool() noexcept { return pool_; }
141141
uint64_t getLookupCount() { return lookupCount_; }
142142

143-
void updateServiceInfo(const ServiceInfo& serviceInfo);
143+
void updateServiceInfo(ServiceInfo&& serviceInfo);
144144
ServiceInfo getServiceInfo() const;
145145

146146
static std::chrono::nanoseconds getOperationTimeout(const ClientConfiguration& clientConfiguration);

0 commit comments

Comments
 (0)