RobertIndie commented on code in PR #296: URL: https://github.com/apache/pulsar-client-cpp/pull/296#discussion_r1252947193
########## lib/RetryableLookupService.h: ########## @@ -50,117 +44,50 @@ class RetryableLookupService : public LookupService, } LookupResultFuture getBroker(const TopicName& topicName) override { - return executeAsync<LookupResult>("get-broker-" + topicName.toString(), - [this, topicName] { return lookupService_->getBroker(topicName); }); + return lookupCache_->run("get-broker-" + topicName.toString(), + [this, topicName] { return lookupService_->getBroker(topicName); }); } Future<Result, LookupDataResultPtr> getPartitionMetadataAsync(const TopicNamePtr& topicName) override { - return executeAsync<LookupDataResultPtr>( + return partitionLookupCache_->run( "get-partition-metadata-" + topicName->toString(), [this, topicName] { return lookupService_->getPartitionMetadataAsync(topicName); }); } Future<Result, NamespaceTopicsPtr> getTopicsOfNamespaceAsync( const NamespaceNamePtr& nsName, CommandGetTopicsOfNamespace_Mode mode) override { - return executeAsync<NamespaceTopicsPtr>( + return namespaceLookupCache_->run( "get-topics-of-namespace-" + nsName->toString(), [this, nsName, mode] { return lookupService_->getTopicsOfNamespaceAsync(nsName, mode); }); } Future<Result, SchemaInfo> getSchema(const TopicNamePtr& topicName, const std::string& version) override { - return executeAsync<SchemaInfo>("get-schema" + topicName->toString(), [this, topicName, version] { + return getSchemaCache_->run("get-schema" + topicName->toString(), [this, topicName, version] { return lookupService_->getSchema(topicName, version); }); } - template <typename T> - Future<Result, T> executeAsync(const std::string& key, std::function<Future<Result, T>()> f) { - Promise<Result, T> promise; - executeAsyncImpl(key, f, promise, timeout_); - return promise.getFuture(); + size_t getNumberOfPendingTasks() const { + return lookupCache_->size() + partitionLookupCache_->size() + namespaceLookupCache_->size() + + getSchemaCache_->size(); Review Comment: It's only used for testing. Do we need to expose it here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org