Skip to content

Commit

Permalink
Merge pull request #22904 from jrafanie/delay_descendant_loader_until…
Browse files Browse the repository at this point in the history
…_app_initialized

Only run load_subclasses after app is initialized
  • Loading branch information
Fryguy authored Feb 21, 2024
2 parents ac938b1 + a7aa6b4 commit f5e3575
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/extensions/descendant_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def scoped_name(name, scopes)

module ArDescendantsWithLoader
def descendants
unless defined? @loaded_descendants
if Vmdb::Application.instance.initialized? && !defined? @loaded_descendants
@loaded_descendants = true
DescendantLoader.instance.load_subclasses(self)
end
Expand All @@ -275,7 +275,7 @@ def descendants
# https://github.com/rails/rails/commit/8f8aa857e084b76b1120edaa9bb9ce03ba1e6a19
# We need to get in front of it, like we do for descendants.
def subclasses
unless defined? @loaded_descendants
if Vmdb::Application.instance.initialized? && !defined? @loaded_descendants
@loaded_descendants = true
DescendantLoader.instance.load_subclasses(self)
end
Expand Down

0 comments on commit f5e3575

Please sign in to comment.