merlimat commented on a change in pull request #1352: Delete inactive 
subscriptions automatically
URL: https://github.com/apache/incubator-pulsar/pull/1352#discussion_r172754555
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
 ##########
 @@ -1407,6 +1409,28 @@ public void checkGC(int gcIntervalInSeconds) {
         }
     }
 
+    @Override
+    public void checkInactiveSubscriptions() {
+        long expirationTime = 
brokerService.pulsar().getConfiguration().getSubscriptionExpirationTimeSeconds()
 * 1000;
+        if (expirationTime <= 0) return;
+
+        subscriptions.forEach((subName, sub) -> {
+            if (sub.getNumberOfEntriesInBacklog() == 0) return;
+            sub.peekNthMessage(1).thenAccept(entry -> {
+                ByteBuf messageMetadataAndPayload = entry.getDataBuffer();
 
 Review comment:
   `messageMetadataAndPayload` needs to be released after usage

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to