Open Bug 1275112 Opened 9 years ago Updated 9 years ago

_create_cf_accessors() should be called once at startup, not as part of Bugzilla::Bug->new

Categories

(Bugzilla :: Bugzilla-General, defect)

5.1.1
defect
Not set
normal

Tracking

()

People

(Reporter: dylan, Unassigned)

References

Details

(Keywords: perf)

User Story

_create_cf_accessors() should be a public class method

we should have a Bugzilla->startup() method that gets called early in app.psgi or mod_perl.pl

Bugzilla::Bug->create_cf_accessors() is only called:
1) from Bugzilla::startup() during script startup
2) from Bugzilla::init_page() if there are custom fields created since our startup time (we'll be using the database's idea of time in all cases)
This method is really weird. It's called from Bugzilla::Bug->new() but it doesn't appear to use any bug data. It does search for custom fields and then creates new methods based on that. It caches this result in the request cache, so subsequent calls are somewhat faster. At first pass it seems like we could move it to the process_cache (although I think we should not have a specific 'process cache' as regular globals/lexicals are faster) but that would break down when new custom fields are created. I definitely think _create_cf_accessors should be called at process startup time, and we'd need some way of knowing if a process should run it again. This could be accomplished by a 'created' timestamp on fielddefs. so that in init_page() we look for any fielddefs entry where custom = 1 and created > $last_one. We can also memcache that query for extra performance. I have a sketch in the user story and I'd appreciate some iteration on the idea.
Keywords: perf
Blocks: 1282533
You need to log in before you can comment on or make changes to this bug.