<p>George Joseph would like Richard Mudgett, Friendly Automation, Sean Bright and Joshua C. Colp to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10833">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "stasis_cache:  Stop caching stasis subscription change messages"<br><br>This commit caused issues with polling when combined with<br>the revert of commit "63d19326be4032dc93e08c379d9d6560a6e1e2f<br>"Revert "app_voicemail: Remove need to subscribe to stasis"<br><br>This reverts commit 94a4eea7f6e486368b35585ea867479f248095c2.<br><br>ASTERISK-28222<br>Reported by: abelbeck<br><br>Change-Id: I0aaab5218a282706dfc6fcbbaeead228d599b99b<br>---<br>M main/stasis_cache.c<br>1 file changed, 22 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/10833/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/stasis_cache.c b/main/stasis_cache.c</span><br><span>index 0d5e492..3e2ab17 100644</span><br><span>--- a/main/stasis_cache.c</span><br><span>+++ b/main/stasis_cache.c</span><br><span>@@ -819,16 +819,29 @@</span><br><span> </span><br><span>         msg_type = stasis_message_type(message);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    /*</span><br><span style="color: hsl(0, 100%, 40%);">-       * app_voicemail used to rely on the cache containing every topic subscribe and</span><br><span style="color: hsl(0, 100%, 40%);">-  * unsubscribe in order to determine if anyone was currently subscribed to a</span><br><span style="color: hsl(0, 100%, 40%);">-     * particular mailbox.  This caused the cache to grow unabated for the life of</span><br><span style="color: hsl(0, 100%, 40%);">-   * the asterisk instance.  Since it no longer needs the cache of these message</span><br><span style="color: hsl(0, 100%, 40%);">-   * types, and no other function needs them, we no longer cache them.</span><br><span style="color: hsl(0, 100%, 40%);">-     */</span><br><span>  if (stasis_subscription_change_type() == msg_type) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ao2_cleanup(caching_topic_needs_unref);</span><br><span style="color: hsl(0, 100%, 40%);">-         return;</span><br><span style="color: hsl(120, 100%, 40%);">+               struct stasis_subscription_change *change = stasis_message_data(message);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           /*</span><br><span style="color: hsl(120, 100%, 40%);">+             * If this change type is an unsubscribe, we need to find the original</span><br><span style="color: hsl(120, 100%, 40%);">+                 * subscribe and remove it from the cache otherwise the cache will</span><br><span style="color: hsl(120, 100%, 40%);">+             * continue to grow unabated.</span><br><span style="color: hsl(120, 100%, 40%);">+          */</span><br><span style="color: hsl(120, 100%, 40%);">+           if (strcmp(change->description, "Unsubscribe") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   struct stasis_cache_entry *sub;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                     ao2_wrlock(caching_topic->cache->entries);</span><br><span style="color: hsl(120, 100%, 40%);">+                      sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);</span><br><span style="color: hsl(120, 100%, 40%);">+                        if (sub) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message));</span><br><span style="color: hsl(120, 100%, 40%);">+                          ao2_cleanup(sub);</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span style="color: hsl(120, 100%, 40%);">+                     ao2_unlock(caching_topic->cache->entries);</span><br><span style="color: hsl(120, 100%, 40%);">+                      ao2_cleanup(caching_topic_needs_unref);</span><br><span style="color: hsl(120, 100%, 40%);">+                       return;</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+             msg_put = message;</span><br><span style="color: hsl(120, 100%, 40%);">+            msg = message;</span><br><span>       } else if (stasis_cache_clear_type() == msg_type) {</span><br><span>          /* Cache clear event. */</span><br><span>             msg_put = NULL;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10833">change 10833</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10833"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0aaab5218a282706dfc6fcbbaeead228d599b99b </div>
<div style="display:none"> Gerrit-Change-Number: 10833 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>