Developer forum

Forum » Development » Live integration code bug

Live integration code bug

Cristina Santos
Reply

When using v2 of LiveIntegration 2.X.X  and DynamicWeb 9.8.6  we were having a bug with liveprices at FetchProductInfos in Product/ProductManager.cs class.

After a previous request with a positive result results were cached and following requests without prices FetchProductInfos would return false due to isLastResponseValid been true.

We commented the follwing to make it work...

//if (IsLastResponseValid())
//{
                // No need to read cache
            //    return false;

//}

This is the code we implemented

private static bool IsLastResponseValid()
        {
            FetchProductInfoResult fetchResult = null;
            if (ProductCacheLevel == CacheLevel.Session)
            {
                var cacheKey = GetCurrentUserProductInfoCacheKey();
                object value = Context.Current.Session[cacheKey];                if (value != null)
                {
                    fetchResult = value as FetchProductInfoResult;
                }
            }
            else
            {
                var pageId = PageView.Current().ID;
                if (FetchProductInfoPageCache.ContainsKey(pageId))
                {
                    fetchResult = FetchProductInfoPageCache[pageId];
                }
            }            if (fetchResult != null && !fetchResult.Response && fetchResult.Executed.Subtract(DateTime.Now).Minutes < 5)
            {
                return true;
            }            return false;
        }

Is there something wrong with this implementation?


Replies

 

You must be logged in to post in the forum