[Asterisk-code-review] stasis cache: Stop caching stasis subscription change messages (asterisk[16])

Joshua Colp asteriskteam at digium.com
Thu Sep 20 09:20:57 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10138 )

Change subject: stasis_cache:  Stop caching stasis subscription change messages
......................................................................

stasis_cache:  Stop caching stasis subscription change messages

Since app_voicemail no longer uses the cache to maintain its state
there is no longer a need to cache these messages.

ASTERISK-27121

Change-Id: I321c708505f5ad8d00e1b0afc4c27dc2ac12ecb4
---
M main/stasis_cache.c
1 file changed, 9 insertions(+), 22 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Sean Bright: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved



diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 9907c6c..acf6fd0 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -817,29 +817,16 @@
 
 	msg_type = stasis_message_type(message);
 
+	/*
+	 * app_voicemail used to rely on the cache containing every topic subscribe and
+	 * unsubscribe in order to determine if anyone was currently subscribed to a
+	 * particular mailbox.  This caused the cache to grow unabated for the life of
+	 * the asterisk instance.  Since it no longer needs the cache of these message
+	 * types, and no other function needs them, we no longer cache them.
+	 */
 	if (stasis_subscription_change_type() == msg_type) {
-		struct stasis_subscription_change *change = stasis_message_data(message);
-
-		/*
-		 * If this change type is an unsubscribe, we need to find the original
-		 * subscribe and remove it from the cache otherwise the cache will
-		 * continue to grow unabated.
-		 */
-		if (strcmp(change->description, "Unsubscribe") == 0) {
-			struct stasis_cache_entry *sub;
-
-			ao2_wrlock(caching_topic->cache->entries);
-			sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);
-			if (sub) {
-				cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message));
-				ao2_cleanup(sub);
-			}
-			ao2_unlock(caching_topic->cache->entries);
-			ao2_cleanup(caching_topic_needs_unref);
-			return;
-		}
-		msg_put = message;
-		msg = message;
+		ao2_cleanup(caching_topic_needs_unref);
+		return;
 	} else if (stasis_cache_clear_type() == msg_type) {
 		/* Cache clear event. */
 		msg_put = NULL;

-- 
To view, visit https://gerrit.asterisk.org/10138
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: I321c708505f5ad8d00e1b0afc4c27dc2ac12ecb4
Gerrit-Change-Number: 10138
Gerrit-PatchSet: 3
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180920/d3491002/attachment.html>


More information about the asterisk-code-review mailing list