Skip to content

Commit

Permalink
[api] add "rake updatepackagemeta" job to fix inconsitent package met…
Browse files Browse the repository at this point in the history
…a database
  • Loading branch information
adrianschroeter committed Oct 26, 2012
1 parent b611778 commit a19b756
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/api/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'workers/update_issues.rb'
task(:updateissues => :environment) { Delayed::Job.enqueue UpdateIssuesJob.new }

require 'workers/update_package_meta_job.rb'
task(:updatepackagemeta => :environment) { u=UpdatePackageMetaJob.new; u.perform }

require 'workers/import_requests.rb'
#task(:importrequests => :environment) { Delayed::Job.enqueue ImportRequestsDelayedJob.new }
task(:importrequests => :environment) { i=ImportRequestsDelayedJob.new; i.perform }
Expand Down
8 changes: 4 additions & 4 deletions src/api/lib/workers/update_package_meta_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ def initialize
end

def perform
DbProject.find(:all).each do |prj|
next unless DbProject.exists?(prj)
prj.db_packages.each do |pkg|
next unless DbPackage.exists?(pkg)
Project.find(:all).each do |prj|
next unless Project.exists?(prj)
prj.packages.each do |pkg|
next unless Package.exists?(pkg)
begin
pkg.set_package_kind
rescue Suse::Backend::HTTPError
Expand Down

0 comments on commit a19b756

Please sign in to comment.