<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/10835">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 commit "Revert "app_voicemail: Remove need to subscribe to stasis"<br><br>This reverts commit 17d6d9e1e7d0db04ebd8d2e0cd9e087ec5462e2f.<br><br>ASTERISK-28222<br>Reported by: abelbeck<br><br>Change-Id: Ib6a16cbe2c0b74c76c64264f525ab647959c1483<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/35/10835/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 acf6fd0..9907c6c 100644</span><br><span>--- a/main/stasis_cache.c</span><br><span>+++ b/main/stasis_cache.c</span><br><span>@@ -817,16 +817,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/10835">change 10835</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/10835"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib6a16cbe2c0b74c76c64264f525ab647959c1483 </div>
<div style="display:none"> Gerrit-Change-Number: 10835 </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>