Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Anyone know how to disable EntryContentPublishedStateAssessor?

Vote:
 

Does anyone have a working example of how to disable the EntryContentPublishedStateAssessor decorator?

Episerver intercepts the default assessor and any new one we try to inject and forceably decorates it with this horrible class.

Many of our customers doesn't use the preorder functionality in this assessor and they still get to pay the database calls for its checks.

Even for those of our customers that would like to have the preorder functionality I can't rule out that many of them would like to publish/show entries on their site before they become available for preorder.

The most common scenario I see is that the entry is shown on the site with a date showing when it will be available for preorder...not a 404 because it isn't "published".

Kind Regards

Erik Norberg

#182475
Sep 20, 2017 16:35
Vote:
 

Piggybacking to this thread and adding some background to this. We had some performance issues when we had a lot of simultaneous users one night. So now we're looking at causes and places to optimize the e-commerce site. The epi version is 11.2.0.

We observed that we get calls to the InventoryService when we load a variant page, which struck us as odd. The calls to the InventoryService are made from EntryContentPublishedStateAssessor.IsPublished. So, looking at that method, it appears that there is some built in functionality that in some case will say that the content is not published depending on the stock status. 

Our interpretation of this is that the implementation should return 404 for entries that are out of stock in some way. We struggle to see the scenarios where customers would like to display the product or not based upon the state of PreorderAvailableUtc. Not as a default implementation anyway. Most use cases is that they want to disable the buy button and show a text that it is out of stock, I believe.

We see that there are other implementations of the IPublishedStateAssessor interface (SimplifiedPublishedStateAssessor, DefaultPublishedStateAssessor) that we have tried to use instead. But as Erik said we haven't been able to override the behaviour.

Anyone that have any other ideas of how we can get around this? We don't get the 404s, but we don't want the logic in EntryContentPublishedStateAssessor.IsPublished to run, because it might be expensive, might even be db calls as Erik mentioned.

#182476
Edited, Sep 20, 2017 16:44
Vote:
 

That's an interesting finding. The class was added to fix a bug - so we are in a compromise state here - how much slower when the check is added? In 10.7.1 and higher (when the class was added), the caching for inventory system is also much better ...

I'll probably file a bug and see if we can do. Will keep you posted. 

#182478
Sep 20, 2017 17:11
Vote:
 

It's not really down to performance principally (all though we found it in a performance cause), it's down to that we don't want that business logic run. Even if the cache is better and we might not get sql queries for most of them, we still have no interest in hitting the inventory cache whenever we route a product page. Maybe Google spiders will crawl all our product pages and the cache is now pretty bust. We need some sort of work around (or "bug fix") for this. We feel this is too much business logic for a framwork to force upon us, regardless of performance implications.

#182479
Sep 20, 2017 17:28
Vote:
 

Fair enough. I filed a bug. How and when it's fixed is up to discussion within the team :). But as this is reported from a partner, we'll make sure to take a look. 

#182480
Sep 20, 2017 17:49
Vote:
 

Great! We'll likely be poking around to try and find an alternative solution for it, if we do we'll update the thread! :)

#182481
Sep 20, 2017 18:08
Vote:
 

On the side note: It is hard to say how much slower it gets when the check is in place.

Even with improved caching the worst case scenario is that the first user will get a tremendeous hit as it is one extra database call for each entry.

Performance wise it will increase linear with how many entries are checked as the IPublishStateAssessor has no support for bulk operations., but always loads the stock status one by one.

#182508
Sep 21, 2017 16:10
Vote:
 

To disable the decorator we have for the time being forceably overridden it:

c.For<IPublishedStateAssessor>().DecorateAllWith((ctx, inner) => (IPublishedStateAssessor)ctx.GetInstance(Type.GetType("EPiServer.Core.Internal.DefaultPublishedStateAssessor, EPiServer")));

Use with care, we are not liable for any problems. innocent

#182562
Edited, Sep 22, 2017 17:34
Vote:
 

It will be removed in upcoming release. (Probably 11.2.6, or 11.3, we're yet to know) 

#182828
Sep 29, 2017 9:39
Vote:
 

It should be in Commerce 11.2.6

#182923
Oct 02, 2017 6:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.