eolivelli commented on a change in pull request #9853:
URL: https://github.com/apache/pulsar/pull/9853#discussion_r591142850



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -2510,8 +2510,13 @@ private int getMessageTTL() throws Exception {
     public CompletableFuture<Void> addSchemaIfIdleOrCheckCompatible(SchemaData 
schema) {
         return hasSchema()
             .thenCompose((hasSchema) -> {
-                if (hasSchema || 
isActive(InactiveTopicDeleteMode.delete_when_no_subscriptions)
-                        || ledger.getTotalSize() != 0) {
+                int numActiveConsumers = subscriptions.values().stream()
+                        .map(subscription -> 
subscription.getConsumers().size())
+                        .reduce(0, Integer::sum);

Review comment:
       Count ?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to