Copied to clipboard

Flag this post as spam?

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


  • René Pjengaard 118 posts 702 karma points c-trib
    Aug 30, 2018 @ 07:41
    René Pjengaard
    0

    orderNumber resets

    Hi Tea Commerce,

    I´m experincing the same issue as here: https://our.umbraco.com/projects/website-utilities/tea-commerce/tea-commerce-support/80530-currentordernumber-resets-to-20

    I wan´t to hear, if Tea Commerce can handle Load Balancing environments out of the box or if there is something i can do to make it work?

    I have 2 projects at the moment where i see this problem. One has loadbalancing and the other one has a local-, stage- and live environment. In both projects, the order number resets occasionally.

    I have licenses and TC version is 3.2.4.

    Best regards René

  • Anders Burla 2560 posts 8256 karma points
    Sep 03, 2018 @ 07:09
    Anders Burla
    0

    Hi René

    We haven't ran Tea Commerce on a load balanced environment our self, so are not that familiar in that area. Could you give a bit more details about how this setup is - how many servers, frontend, backend, DB etc.

    Regarding the local, stage and live environment - is that an Umbraco Cloud setup? Is there any load balancing done automatically by Umbraco Cloud maybe?

    Kind regards

    Anders

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 03, 2018 @ 07:22
    René Pjengaard
    0

    Hi Anders,

    i think we need to solve the local/stage/live setup before handling the load-balancing issue.

    Our setup is not Umbraco Cloud. It is just 3 invironments who shares a Azure Database.

    /R

  • Anders Burla 2560 posts 8256 karma points
    Sep 03, 2018 @ 07:30
    Anders Burla
    0

    I think the problem is the shared DB. TC has a caching layer where most business objects are cached - stores, shipping methods, order statuses etc. The store object has the CurrentOrderNumber property. That is increased when an order is finalized and that value is saved to the DB.

    But if the live environment has a cache where the value is 20 and 5 orders is finalized. Then the cache layer and DB value should be 25. If you then finalize an order on the dev environment which had 20 in the cache (if the dev environment was running at the same time as the live), then 21 would be saved to the DB. So now its out of sync because you use the same DB for the three environments.

    Would it make more sense to run with separate DB? Another option is to override the StoreService in TC and not cache the Store object. But that would hit performance as the store object is used in almost everything in TC.

    /A

  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 03, 2018 @ 09:06
    René Pjengaard
    0

    Hi Anders,

    thanks for the answer. I feared that would be your answer. It´s not an option at the moment to have 3 databases. So how do i override the StoreService so that it is not cached?

    best regards René

  • Anders Burla 2560 posts 8256 karma points
    Sep 03, 2018 @ 11:27
    Anders Burla
    100

    Here is how to override a default provider in Tea Commerce.

    https://docs.teacommerce.net/v3.0.0/reference#override-default-providers

    You would need to override TeaCommerce.Api.Services.IStoreService in TeaCommerce.Api. Create a dll file with this and TC automatically picks it up on application start.

    No reason to inherit from the Tea Commerce Store Service. Just implement the IStoreService service interface. Just have a IStoreRepository in your constructor to fetch them from the DB. in GetAll and Get

    private readonly IStoreRepository _repository;
    public StoreService( IStoreRepository repository ){
       _repository = repository;
    }
    
  • René Pjengaard 118 posts 702 karma points c-trib
    Sep 03, 2018 @ 13:21
    René Pjengaard
    0

    Hi Anders,

    thank you for the help. To help others i post the working code below. There is no way to only clear the orderNumber property, is there?

    Best regards René

    namespace customer.Models.Store
    

    { [SuppressDependency( "TeaCommerce.Api.Services.IStoreService", "TeaCommerce.Api" )] public class ClearCacheStoreService : IStoreService { private readonly IStoreRepository _repository;

        public ClearCacheStoreService(IStoreRepository repository, ICacheService cacheService)
        {
            _repository = repository;
        }
    
        public IEnumerable<TeaCommerce.Api.Models.Store> GetAll()
        {
            return _repository.GetAll();
        }
    
        TeaCommerce.Api.Models.Store IStoreService.Get(long storeId)
        {
            return _repository.Get(storeId);
        }
    }
    

    }

Please Sign in or register to post replies

Write your reply to:

Draft