Skip to content

Commit

Permalink
Check for agent class file to determine if it's valid (#1907)
Browse files Browse the repository at this point in the history
The previous approach of checking if the class is defined caused problems when
the agent class had not yet been loaded by the process. Using Agent.valid_type?
instead seems to be the approach that is taken elsewhere in the codebase, and it
does not suffer from this problem.
  • Loading branch information
sentience authored and cantino committed Feb 12, 2017
1 parent 11b6a2c commit 3dda1ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/agent.rb
Expand Up @@ -418,7 +418,7 @@ def run_schedule(schedule)
return if schedule == 'never'
types = where(:schedule => schedule).group(:type).pluck(:type)
types.each do |type|
next unless const_defined?(type)
next unless valid_type?(type)
type.constantize.bulk_check(schedule)
end
end
Expand Down

0 comments on commit 3dda1ff

Please sign in to comment.