fix: Rebuild cache in background (#17487)

This commit is contained in:
Faris Ansari 2019-05-04 22:38:13 +05:30 committed by Nabin Hait
parent 5cf12a4640
commit 14425575b7
2 changed files with 5 additions and 1 deletions

View File

@ -97,6 +97,10 @@ class ItemVariantsCacheManager:
for key in keys:
frappe.cache().hdel(key, self.item_code)
def rebuild_cache(self):
self.clear_cache()
enqueue_build_cache(self.item_code)
def build_cache(item_code):
frappe.cache().hset('item_cache_build_in_progress', item_code, 1)

View File

@ -964,7 +964,7 @@ def invalidate_item_variants_cache_for_website(doc):
if item_code:
item_cache = ItemVariantsCacheManager(item_code)
item_cache.clear_cache()
item_cache.rebuild_cache()
def check_stock_uom_with_bin(item, stock_uom):