{"id":107209,"date":"2022-09-23T07:00:00","date_gmt":"2022-09-23T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=107209"},"modified":"2022-09-23T06:51:36","modified_gmt":"2022-09-23T13:51:36","slug":"20220923-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20220923-00\/?p=107209","title":{"rendered":"Why am I receiving <CODE>SHCNE_<WBR>UPDATE&shy;DIR<\/CODE> notifications that my code never generates?"},"content":{"rendered":"<p>A customer had created a custom shell namespace, and they generated notifications for items in that namespace. Meanwhile, they also had code that listened for those notifications, and they found that sometimes the listener received <code>SHCNE_<wbr \/>UPDATE\u00adDIR<\/code> notifications, which is odd because their namespace never generates those notifications. So where did they come from?<\/p>\n<p>The shell change notification system will sometimes <i>coalesce<\/i> notifications. It typically does this to avoid flooding the notification system.<\/p>\n<p>The customer wanted to know if coalescing was more likely to happen when the notifications are generated at high frequency. They found that the behavior varied from system to system. Some of them were seeing the <code>SHCNE_<wbr \/>UPDATE\u00adDIR<\/code>, and others weren&#8217;t.<\/p>\n<p>Yes, the rate of notification generation is a factor. If you quickly generate a hundred <code>SHCNE_<wbr \/>UPDATE\u00adITEM<\/code> notifications for items all within the same folder, the shell change notification system is probably going to replace them all with a single <code>SHCNE_<wbr \/>UPDATE\u00adDIR<\/code> notification. The likelihood of coalescing also increases if the recipient is slow to process the notifications.<\/p>\n<p>In such cases, the shell replaces the separate &#8220;item 1 changed&#8221;, &#8220;item 2 changed&#8221;, &#8220;item 3 changed&#8221; notifications with a single <code>SHCNE_<wbr \/>UPDATE\u00adDIR<\/code>, which means &#8220;There were changes to this folder.&#8221; This reduces the amount of notification traffic, reduces the memory needed to keep track of those notifications, and hopefully improves performance on the clients, since they can just refresh the whole folder instead of churning through hundreds of tiny little notifications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You did generate them, indirectly.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-107209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>You did generate them, indirectly.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/107209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=107209"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/107209\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=107209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=107209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=107209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}