diff options
author | Matt Robinson <matt@puppetlabs.com> | 2011-05-26 14:36:19 -0700 |
---|---|---|
committer | Matt Robinson <matt@puppetlabs.com> | 2011-05-26 14:36:19 -0700 |
commit | 0bcbca53f3248137de517a4942e4db70ab06e296 (patch) | |
tree | c0d3d770a3ab7f9957e02f28cf6b02cc6c0b8b3e /lib/puppet/util/autoload.rb | |
parent | 996dc076e9ca61613f80fc79f0ffe667b14d1ebb (diff) | |
download | puppet-0bcbca53f3248137de517a4942e4db70ab06e296.tar.gz puppet-0bcbca53f3248137de517a4942e4db70ab06e296.tar.xz puppet-0bcbca53f3248137de517a4942e4db70ab06e296.zip |
maint: Dedup the loadpath so we don't have to walk it multiple times
If the user's path has duplicate entries, we end up looking at them
multiple times. This has bitten people in the past in that if you get a
lot of duplication it can make autloading a lot slower. Really the user
shouldn't be duplicating their path, but since we can't control that,
this is a safe fix to prevent them from having autoload slowness.
Paired-with: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet/util/autoload.rb')
-rw-r--r-- | lib/puppet/util/autoload.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index f0dd0a5c5..0e7025aef 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -124,7 +124,7 @@ class Puppet::Util::Autoload # The list of directories to search through for loadable plugins. def searchpath(env=nil) - search_directories(env).collect { |d| File.join(d, @path) }.find_all { |d| FileTest.directory?(d) } + search_directories(env).uniq.collect { |d| File.join(d, @path) }.find_all { |d| FileTest.directory?(d) } end def module_directories(env=nil) |