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.
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?
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.
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?
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
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é
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
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
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
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é
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
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é
{ [SuppressDependency( "TeaCommerce.Api.Services.IStoreService", "TeaCommerce.Api" )] public class ClearCacheStoreService : IStoreService { private readonly IStoreRepository _repository;
}
is working on a reply...