Commit 52a7393f authored by Łukasz Nowak's avatar Łukasz Nowak

Add speedmeter and speedup.

Use catalog, as contentValues dies on big modules.

Show the speed of invocation.
parent e1962313
No related merge requests found
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
BLACKLIST_RELATIVE_URL_LIST = (\n BLACKLIST_RELATIVE_URL_LIST = (\n
\'accounting_module/template_sale_invoice_transaction\',\n \'accounting_module/template_sale_invoice_transaction\',\n
\'open_sale_order_module/slapos_accounting_open_sale_order_line_template\',\n \'open_sale_order_module/slapos_accounting_open_sale_order_line_template\',\n
...@@ -84,10 +85,14 @@ if bg:\n ...@@ -84,10 +85,14 @@ if bg:\n
\n \n
deleted = False\n deleted = False\n
if context in module_list:\n if context in module_list:\n
id_list = [q.getId() for q in context.contentValues()[:20] if q.getRelativeUrl() not in BLACKLIST_RELATIVE_URL_LIST]\n b = DateTime().timeTime()\n
id_list = [q.getId() for q in \\\n
portal.portal_catalog(parent_uid=context.getUid(), limit=20) if q.getRelativeUrl() not in BLACKLIST_RELATIVE_URL_LIST]\n
if id_list:\n if id_list:\n
deleted = True\n deleted = True\n
context.deleteContent(id_list)\n context.deleteContent(id_list)\n
e = DateTime().timeTime() - b\n
script.log(\'Deleted %s from %s in %.3ss, so %.3s/s\' % (len(id_list), context.getId(), e, len(id_list)/e))\n
\n \n
if deleted:\n if deleted:\n
getattr(context.activate(tag=tag), \'03_ERP5Site_deleteVifibAccounting\')(bg=0)\n getattr(context.activate(tag=tag), \'03_ERP5Site_deleteVifibAccounting\')(bg=0)\n
......
47 48
\ No newline at end of file \ No newline at end of file
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 to comment