プロジェクト

全般

プロフィール

Vote #74501

完了

Issue#update_nested_set_attributes comparing nil with empty string

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
低め
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
70
issue_org_id:
15135
author_id:
86283
assigned_to_id:
1
comments:
1
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
73
ステータス-->[Closed]

説明

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 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0