-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve post-checkout indexing #189
Conversation
There are some problems with this PR, I'll post an update in the next few days. |
Actually I think its ok, but I've updated the description to clarify exactly what has changed and the potential issues. |
…ng stock item model with stale data
5fe2972
to
f6fe566
Compare
Currently i see a problem in the function reindexQuoteInventory with other extensions for example for FPC or Varnish, without hacking they don't flush the specific product cache. I have tested it with https://github.com/GordonLesti/Lesti_Fpc |
This is a possible solution to fixing the incorrect stock when under high load, high concurrency on a single item and slow payment gateways. Solution taken from @bob2021 OpenMage#189
Looking at what is done with Index'ing in you work. I have a concern that the data on the store with be completely out of sync therefore giving the customers the wrong information if the index mode is either |
I think that's a valid argument, the main reason it ended up in this PR is that while I was trying to debug some of the other problems mentioned, I found that some of the indexers were still running even though I thought I had disabled them by setting them to manual mode - so from a developers perspective, the behaviour is inconsistent. From a customer/store owners perspective (and for backwards compatibility) it probably does make sense to force the indexing to take place. Though I think there are still benefits from the other features in this PR (indexer locking and conditional price indexing) |
Hi there, I'm testing this solution and I have a doubt. If I switch stock and price indexes to manual mode, using your approach, reindex is not done during checkout, ok. My concern is that the stock index doesn't show "Update is required" in the admin. Then, I cancel that order and this time the index shows that it needs to be updated. Even setting the index to update on save, the index doesn't show "update is required". Does it make sense to you guys? |
During checkout the indexer resource methods are called directly, which bypasses the index event system that normally triggers the "update is required" status. Cancelling an order doesn't bypass the index event system, so the "update is required" status is triggered as normal. However, for the reasons @googlygoo mentioned, it is not usually desirable to disable the real time stock and price indexing. |
Yes and I see a problem in that bypass. I have chosen Manual Mode so it will not run, good, but at least you should be aware of it ("Update is required"), Don't you think so? If you are aware of it, you can just update it manually or in my case, with a partial scheduled reindex tool. I'll be working on that. I agree with @googlygoo, but as you said, for those who have configured manual mode, this is very confusing. Moreover, not saving the stock item model has also side effects, as you also mention, in user experience (layered navigation , search, ...). |
I am no longer involved with Magento development and I will not be contributing any further changes to this PR so I am closing it. |
I understand the situation but a simple statement that you are no longer involved in the project was enough without closing the PR, leaving it to the appreciation of others who are still active if your work so far can be useful OpenMage. |
since there were many doubts in the comments of this PR, the author is no longer in the openmage world, there's a conflict and it would need a rebase too... I'll close it for the time being. |
This is part of a group of PRs containing the changes discussed in issue #152
There are a few issues with
Mage_CatalogInventory_Model_Observer::reindexQuoteInventory()
:Exceptions aren't caught
Throwing an exception here will roll back the inventory, but it is too late as the order has already been placed.EDIT: No longer true as Safer DB transactions #187 has been mergedStock & price indexer resource models are accessed directly
Stock item models are saved for low/OOS stock items
This PR:
Mage_CatalogInventory_Model_Resource_Stock
Possible breaking changes:
I don't really like the way this solution duplicates the logic from the stock item model and accesses so many resource methods, but it gives maximum control over the indexing that occurs, and ensures the inventory data is kept consistent.