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

George Joseph asteriskteam at digium.com
Thu Sep 13 11:09:27 CDT 2018


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/10136


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, 3 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/10136/1

diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 3e2ab17..d9dd2ac 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -819,29 +819,10 @@
 
 	msg_type = stasis_message_type(message);
 
+	/* There's no longer any need to need to cache every subscribe and unsubscribe */
 	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/10136
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I321c708505f5ad8d00e1b0afc4c27dc2ac12ecb4
Gerrit-Change-Number: 10136
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180913/826308fd/attachment-0001.html>


More information about the asterisk-code-review mailing list