Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-2629 ensure queue auto-delete after expiration #2992

Closed
wants to merge 1 commit into from

Conversation

jbertram
Copy link
Contributor

No description provided.

@@ -84,8 +84,7 @@ public static boolean messageCountCheck(Queue queue) {
}

public static boolean delayCheck(Queue queue) {
long consumerRemovedTimestamp = queue.getConsumerRemovedTimestamp();
return consumerRemovedTimestamp != -1 && System.currentTimeMillis() - consumerRemovedTimestamp >= queue.getAutoDeleteDelay();
return System.currentTimeMillis() - queue.getConsumerRemovedTimestamp() >= queue.getAutoDeleteDelay();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the condition consumerRemovedTimestamp != -1 could change the semantic of the public method delayCheck. With this change delayCheck will return true before removing a consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will change the semantic, and that was intended. This particular check is no longer desirable as it will preclude auto-deleting a queue where all the messages have expired but no consumer has ever connected. I implemented a new check in org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.AddressQueueReaper#queueWasUsed which resolves this issue. The delayCheck method is only used internally as it's not part of the user-facing API so I don't have any qualms with changing its semantics.

@jbertram jbertram force-pushed the ARTEMIS-2629 branch 2 times, most recently from 73cb5cb to 7dc3459 Compare February 25, 2020 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants