Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rody 80 posts 280 karma points
    Jan 29, 2017 @ 21:50
    Rody
    0

    Why aren't the CustomOrderLineCalculator run on HTTP thread

    Why do the CustomOrderLineCalculators do not run on the same HTTP thread as the website. This brings some large issues on a site we are working on.

    First: we cannot seem to debug the Custom OrderLineCalculators using Visual Studio. It will just not hit the breakpoint.

    Second: We have the following requirement. Members all have separate discount rules with complicated logic behind them. Which says: User A can buy this product this month with 12% discount, but User B can buy this product with 16% discount.

    These rules are all created on the fly using data from the Member and previous order data, other members and some external factors. This is not a problem, we cache all this information in the website using the HttpRuntime.Cache which we refresh when we have new information. This works flawlessly.

    However when trying to access the cache in the CustomOrderLineCalculator, it is always empty. This is a problem, because building up this cache takes a couple of seconds. Every time the CustomOrderLineCalculator runs (and that is a lot of times on a large order) this will be rebuild.

    I've even tried using only the MemberShipService to get the required data from the member in the CustomOrderLineCalculator, however this is not quite fast enough.

    Is there anything I can do to improve this?

  • Rody 80 posts 280 karma points
    Jan 31, 2017 @ 15:51
    Rody
    0

    Actually, I did some more research and found out something stranger is happening. The custom order line calculators can access the HttpRuntime.Cache, however when converting the items in the cache to the correct (custom) objects gives some strange problems:

    System.InvalidCastException: [A]Models.BusinessPartnerModel cannot be cast to [B]Models.BusinessPartnerModel. Type A originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\954409ca\e56b7dd7\assembly\dl3\8b57eec2\940aaf10_c97bd201\Models.dll'. Type B originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in a byte array.

    But, this seems to be the case because the custom classes are in the same assembly as the Umbraco project. When I extract them into a separate project everything seems fine.

    However I still cannot debug the custom order line calculators.

    Any ideas on that?

  • Anders Burla 2560 posts 8256 karma points
    May 08, 2017 @ 08:11
    Anders Burla
    1

    Please send email with contact info to [email protected], so we can send you Tea Commerce 3.2.2 and see if that fixes the bug. It should :)

  • Anders Burla 2560 posts 8256 karma points
    May 08, 2017 @ 10:52
    Anders Burla
    100

    Fixed in Tea Commerce 3.2.2

  • Rody 80 posts 280 karma points
    May 08, 2017 @ 18:11
    Rody
    0

    Thanks! This makes live so much easier. Just tested it on a project.

Please Sign in or register to post replies

Write your reply to:

Draft