Merge pull request #534 from warpc/510-resque

[#510] Fix problem: do not add task in queue:
* Remove loner parameter to avoid queue ignore;
* Fix git hook process - do not require 7th param;
* Remove write_hook from queue.
This commit is contained in:
Vladimir Sharshov 2012-06-19 16:29:06 -07:00
commit d3f35d1d28
4 changed files with 8 additions and 9 deletions

View File

@ -168,7 +168,7 @@ class BuildList < ActiveRecord::Base
end
end
later :publish, :loner => true, :queue => :clone_build
later :publish, :queue => :clone_build
def set_version_and_tag
pkg = self.packages.where(:package_type => 'source', :project_id => self.project_id).first

View File

@ -5,7 +5,7 @@ class GitHook
include Resque::Plugins::Status
def initialize(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type)
def initialize(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type = nil)
@repo, @newrev, @oldrev, @refname, @newrev_type, @oldrev_type = repo, newrev, oldrev, ref, newrev_type, oldrev_type
if @owner = User.where(:uname => owner_uname).first || Group.where(:uname => owner_uname).first!
@project = @owner.own_projects.where(:name => repo).first!

View File

@ -184,7 +184,7 @@ class Platform < ActiveRecord::Base
def destroy
with_skip {super} # avoid cascade XML RPC requests
end
later :destroy, :loner => true, :queue => :clone_build
later :destroy, :queue => :clone_build
protected

View File

@ -41,7 +41,7 @@ class Project < ActiveRecord::Base
after_create :attach_to_personal_repository
after_create :create_git_repo
after_create {|p| p.fork_git_repo unless is_root?} # later with resque
after_create {|p| p.fork_git_repo unless p.is_root?}
after_save :create_wiki
after_destroy :destroy_git_repo
@ -247,15 +247,15 @@ class Project < ActiveRecord::Base
def create_git_repo
if is_root?
Grit::Repo.init_bare(path)
write_hook # later with resque
write_hook
end
end
def fork_git_repo
dummy = Grit::Repo.new(path) rescue parent.git_repository.repo.fork_bare(path)
now_write_hook
write_hook
end
later :fork_git_repo, :loner => true, :queue => :fork_import
later :fork_git_repo, :queue => :fork_import
def destroy_git_repo
FileUtils.rm_rf path
@ -267,7 +267,7 @@ class Project < ActiveRecord::Base
self.srpm = nil; save # clear srpm
end
end
later :import_attached_srpm, :loner => true, :queue => :fork_import
later :import_attached_srpm, :queue => :fork_import
def create_wiki
if has_wiki && !FileTest.exist?(wiki_path)
@ -300,5 +300,4 @@ class Project < ActiveRecord::Base
rescue Exception # FIXME
end
later :write_hook, :loner => true, :queue => :hook
end