]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stasis_cache: Stop caching stasis subscription change messages
authorGeorge Joseph <gjoseph@digium.com>
Thu, 13 Sep 2018 16:06:00 +0000 (10:06 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 20 Sep 2018 12:30:24 +0000 (07:30 -0500)
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

main/stasis_cache.c

index 3e2ab1722e6d02a6a3d9b005ff82d2bba8fcb77b..0d5e492354f0f91708fcda8e354d953931838d69 100644 (file)
@@ -819,29 +819,16 @@ static void caching_topic_exec(void *data, struct stasis_subscription *sub,
 
        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;