Vote #74501
完了Issue#update_nested_set_attributes comparing nil with empty string
0%
説明
I had problem with slow issue update. Issue have ~20 subtasks and 1 related issue. Update on that task always ended with timeout error.
It's appears that Issue#update_nested_set_attributes (after_save hook) there is "comparision parent_issue_id != parent_id":http://www.redmine.org/projects/redmine/repository/entry/branches/2.3-stable/app/models/issue.rb#L1277.
In my case parent_issue_id was nil and parent_id empty string, it's leads to unnecessary code execution.
When I change:
elsif parent_issue_id != parent_id
to
elsif parent_issue_id.to_i != parent_id.to_i
update is now 4 times faster.
Ruby: 1.9.3-p429
Rails: 3.2.13
Redmine: 2.3.3
journals
I fixed the root cause in @parent_issue_id=@ rather than the comparaison and added a few tests to make sure that this code is called only when needed (r12226), thanks for pointing this out.
--------------------------------------------------------------------------------
Admin Redmine さんが3年以上前に更新
- カテゴリ を Code cleanup/refactoring_30 にセット
- 対象バージョン を 2.4.0_70 にセット