Working on issue #981 - Improved LDAP sync performan by caching entry count result.
This commit is contained in:
parent
e3891ebeed
commit
508f621377
1 changed files with 8 additions and 5 deletions
|
@ -51,18 +51,21 @@ module Import
|
|||
|
||||
def self.pre_import_hook(_records, *_args)
|
||||
super
|
||||
add_sum_to_statistics
|
||||
end
|
||||
|
||||
#cache_key = "#{@ldap.host}::#{@ldap.port}::#{@ldap.ssl}::#{@ldap.base_dn}"
|
||||
#if !@dry_run
|
||||
# sum = Cache.get(cache_key)
|
||||
#end
|
||||
def self.add_sum_to_statistics
|
||||
cache_key = "#{@ldap.host}::#{@ldap.port}::#{@ldap.ssl}::#{@ldap.base_dn}::#{@config[:user_filter]}"
|
||||
if !@dry_run
|
||||
sum = Cache.get(cache_key)
|
||||
end
|
||||
|
||||
sum ||= @ldap.count(@config[:user_filter])
|
||||
|
||||
@statistics[:sum] = sum
|
||||
|
||||
return if !@dry_run
|
||||
#Cache.write(cache_key, sum, { expires_in: 1.hour })
|
||||
Cache.write(cache_key, sum, { expires_in: 1.hour })
|
||||
end
|
||||
|
||||
def self.add_to_statistics(backend_instance)
|
||||
|
|
Loading…
Reference in a new issue