Developer forum

Forum » Development » Site hangs after saving groups

Site hangs after saving groups

Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

We have a site with a lot of products and when a group is saved then the site hangs for several seconds as we a missing some logic to check whether url dependent properties are changed. Please take a look a the existing code here from ShopUrlDataProvider:

        [Subscribe(Notifications.Ecommerce.Group.AfterSave)]
        [Subscribe(Notifications.Ecommerce.Group.Deleted)]
        public class GroupChangedObserver : NotificationSubscriber
        {
            public override void OnNotify(string notification, NotificationArgs args)
            {
                UrlHelper.SetResetNeeded();
            }
        }

And compared to the logic for changing products which are actually doing this:

        [Subscribe(Notifications.Ecommerce.Product.AfterSave)]
        [Subscribe(Notifications.Ecommerce.Product.AfterDelete)]
        public class ProductChangedObserver : NotificationSubscriber
        {
            public override void OnNotify(string notification, NotificationArgs args)
            {
                var changeAffectUrlIndex = false;
                if (args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Product.AfterSaveArgs)
                {
                    var saveArgs = args as Notifications.Ecommerce.Product.AfterSaveArgs;
                    var beforeSaveProduct = saveArgs.ProductBeforeChanges;
                    var afterSaveProduct = saveArgs.Product;

                    if (beforeSaveProduct != null)
                    {
                        changeAffectUrlIndex |= !beforeSaveProduct.Id.Equals(afterSaveProduct.Id);
                        changeAffectUrlIndex |= !beforeSaveProduct.VariantId.Equals(afterSaveProduct.VariantId);
                        changeAffectUrlIndex |= !beforeSaveProduct.LanguageId.Equals(afterSaveProduct.LanguageId);
                        changeAffectUrlIndex |= !beforeSaveProduct.Name.Equals(afterSaveProduct.Name);
                        changeAffectUrlIndex |= !beforeSaveProduct.Meta.Url.Equals(afterSaveProduct.Meta.Url);
                    }
                    else
                    {
                        changeAffectUrlIndex = true;
                    }
                }

                if (changeAffectUrlIndex)
                {
                    lazyProductUrlDataIndex = new Lazy<ConcurrentDictionary<string, Dictionary<string, UrlDataNode>>>(InitializeProductUrlDataIndex);
                    UrlHelper.SetResetNeeded();
                }
            }
        }

 

Hope you will look into this.

 

Best regards, Anders


Replies

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

Any update on this one?

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

Can I please have an update on this one?

 

Best regards, Anders

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Created this pull request, devops#11281:

https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/11281/

 
Anders Ebdrup
Anders Ebdrup
Reply

Nice, it is looking great! And will definitely help a lot on the work in the administrationen and on the first following page load on the frontend!

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Anders 

Feature #11281 has been implemented in Dynamicweb version 9.14.7
Get this from download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Kind Regards
Care Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum