Project

General

Profile

Actions

Defect #15135

closed

Issue#update_nested_set_attributes comparing nil with empty string

Added by Rafał Lisowski about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Low
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

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.
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

Actions

Also available in: Atom PDF