<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/10836">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 reverts commit ad961fd7c3313f989d6fa16ba2fc9b138cee4cb5.<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>ASTERISK-28222<br>Reported by: abelbeck<br><br>Change-Id: I582534ef730923b16e137021e24f6f87dad0d2b4<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/36/10836/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/10836">change 10836</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/10836"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I582534ef730923b16e137021e24f6f87dad0d2b4 </div>
<div style="display:none"> Gerrit-Change-Number: 10836 </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>