Optimisation: only query database if the package is not obviously blacklisted
Performance gain: 20x
This commit is contained in:
parent
9b3f05bad9
commit
13218841f4
1 changed files with 2 additions and 2 deletions
|
|
@ -74,11 +74,10 @@ task :import_debian => :environment do
|
|||
Rails.logger.info "> Package: #{package[:Package]}"
|
||||
#Rails.logger.debug "Fetching package informaton from the database"
|
||||
|
||||
db_package = Package.find_by name: package[:Package]
|
||||
|
||||
if package_blacklisted? package
|
||||
# Should the package get removed from the database?
|
||||
if REMOVE_BLACKLISTED_PACKAGE
|
||||
db_package = Package.find_by name: package[:Package]
|
||||
if db_package
|
||||
Rails.logger.info "Removing blacklisted package '#{package[:Package]}' from database"
|
||||
db_package.destroy
|
||||
|
|
@ -88,6 +87,7 @@ task :import_debian => :environment do
|
|||
next
|
||||
end # if blacklisted
|
||||
|
||||
db_package = Package.find_by name: package[:Package]
|
||||
unless db_package
|
||||
Rails.logger.debug "No such package in our database."
|
||||
next
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue