Developer forum

Forum » PIM » Timeout reading ProductViewModel.ProductCategories in a Feed template

Timeout reading ProductViewModel.ProductCategories in a Feed template

Jacob Nilsson
Reply

I'm working on a feed inspired of the template from the Swift example Templates/Feeds/Dynamicweb CSV.cshtml with @inherits ViewModelTemplate<ProductListViewModel>.

When there is any values for product.ProductCategories.Values.Any() I get a timeout System.Data.SqlClient.SqlException:
"Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."

For instance this would throw that exception:
var productCategories = Model.Products.Where(product => product.ProductCategories != null && product.ProductCategories.Values.Any()).Select(products => products.ProductCategories.Values).FirstOrDefault();

Even a single usage on a single product causes a timeout which would seem to be something that would not take long:
var values = knownProductWithProductCategories.ProductCategories.Values;

I've been trying to do a workaround using services and managed to get the product categories and fields that way without any performance issues or timeouts using the following methods.
Dynamicweb.Ecommerce.Services.Products.GetProductByNumber
Dynamicweb.Ecommerce.Services.ProductCategories.GetCategories
Dynamicweb.Ecommerce.Services.ProductCategoryFields.GetFieldsByCategoryId

There is also a service for values:
Dynamicweb.Ecommerce.Services.ProductCategoryFieldValueService
But there are no useful public methods on that which makes this a dead end.

Has anyone encountered anything similar and is there some kind of known workaround for this?

Is there any way to increase the timeout peroiod?


Replies

 
Igor Ivanov Dynamicweb Employee
Igor Ivanov
Reply

Hi Jacob,

You should not be getting timeouts when reading custom field values from the product model unless you have an extremely large data set somewhere, like maybe an integration job that kept writing to an ecom data over and over again

 

You must be logged in to post in the forum