Modify ↓
Opened 13 years ago
Closed 5 years ago
#9173 closed defect (wontfix)
Update of trac.ini occurs frequently when an order of the custom-made field is changed.
Reported by: | wadatka | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Component: | CustomFieldAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
Update of trac.ini occurs only the number of a customfield when an order of the custom-made field is changed.
So, when there is the custom-made field in large quantities, It takes time long till completion of processing.
The same phenomenon occurs also at the time of deletion of the customfield.
The following patch fixes this issue:
-
customfieldadmin.py
85 85 raise TracError, 'No custom field selected' 86 86 for name in sel: 87 87 cfdict = {'name': name} 88 88 cfapi.delete_custom_field(cfdict) 89 89 req.redirect(req.href.admin(cat, page)) 90 90 91 91 elif req.args.get('apply'): … … 101 101 if cur_cf.has_key('options'): 102 102 if cur_cf.get('optional', False): 103 103 cur_cf['options'] = [''] + cur_cf['options'] 104 104 cfapi.update_custom_field(cur_cf) 105 105 req.redirect(req.href.admin(cat, page)) 106 106 107 107 cf_list = []
Attachments (0)
Change History (2)
comment:1 Changed 13 years ago by
comment:2 Changed 5 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Will fix when reimplementing in trac:#11469.
Note: See
TracTickets for help on using
tickets.
I don't think you can take
cfdict
/cur_cf
out of the loop and delete/update it afterwards? If so you would only do the change for the last item in the selection - all but the last selected field would be ignored.I can visualize the need for some optimization in the case of lots of changes, as you are correct in that it is not so efficient to fully make each change, and reorder and commit to file for each one. It simplifies the code and API, but it is not very efficient.
Also, seeing that each write to
trac.ini
triggers a Tracenv
reload, you may also get environments with non-complete states (just some fields deleted or just some fields in new order). Usually quite harmless, but for a site under heavy load with many concurrent requests the high number of writes will trigger a large number of reloads which generally impacts the performance of the whole site for the duration of the custom field admin request.Perhaps some sort of transaction handling in the API may be useful, something that skips clean/reorganize steps in mid-transaction and only commits everything at the end?