void-ptr974 commented on code in PR #25915:
URL: https://github.com/apache/pulsar/pull/25915#discussion_r3338088093


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java:
##########
@@ -665,13 +665,19 @@ protected Consumer getActiveConsumer(Subscription 
subscription) {
         return null;
     }
 
-    protected boolean hasLocalProducers() {
+    protected boolean hasProducersActive() {
         if (producers.isEmpty()) {
             return false;
         }
         for (Producer producer : producers.values()) {
             if (!producer.isRemote()) {
                 return true;
+            } else {
+                // If the remote producer still replicating messages, do not 
delete the topic.
+                if (System.currentTimeMillis() - 
producer.getLatestPublishTime() < (brokerService.getPulsar()
+                        
.getConfig().getBrokerReplicationInactiveThresholdSeconds() * 1000)) {

Review Comment:
   Minor: should this use `1000L` or `TimeUnit.SECONDS.toMillis(...)`?
   
   Since `brokerReplicationInactiveThresholdSeconds` is an `Integer`, `* 1000` 
is evaluated as int arithmetic before the comparison. For larger configured 
values, the millisecond threshold could overflow and make this active check 
incorrect.



-- 
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: [email protected]

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

Reply via email to