Commit 1f254aa7 by Xiaowu Zhang

erp5_trade: use shorter cache for resource list

erp5_ui_long is too long for user to use fast input for the following scenario:
1. user create purchase order
2. user use fast input to enter product with reference 324214(a missing product)
3. user type 324214 in fast input, it found nothing in Product or Service
4. then user create such product 324214
5. then user go back to purchase order and type again 324214
since previous result is still cached for one hour and user still can't find it.

in one hour, user is not available to add such product
parent a7fec1ef
......@@ -64,7 +64,7 @@ sql_kw['default_use_uid'] = [context.portal_categories.resolveCategory(use).getU
getResourceItemList = CachingMethod(getResourceItemList, ("getResourceItemList", context.aq_parent.getId()),
cache_factory="erp5_ui_long")
cache_factory="erp5_ui_short")
return getResourceItemList(sql_kw)
  • I don't know this code well, but have you considered completly dropping the CachingMethod ?

    I see that cell is always passed, so if I understand correctly we always search with title/reference. Cache parameter also include the delivery id, so there should almost never be cache hits.

    I think this is used only for this dialog:

    1. enter product reference image

    2. click Update, the list gets populated.

    3. choose in the list the product image

    ( ie. it's a kind of "workaround widget" because dialogs does not support relation field )

    With this change, it's surely better, but in the described scenario, there's still that the problem that in step 5 from the scenario in the commit message, the product is not listed.

  • I fully agree, I would just remove the cache for a script just used for fast inputs. And like written by Jérôme, cache hits would be rare. So there is no benefit, and we just have extra complexity. It might just be needed to set some limit at 20 or so in the searchResult to avoid getting thouzands of values.

  • ok, i'll remove cache and limit searchResult to 20

    Edited by Xiaowu Zhang
  • mentioned in commit f1bbc5aa

    Toggle commit list
  • mentioned in commit cedric.leninivin/erp5@fa4ca0c5

    Toggle commit list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment