Skip to content

Commit

Permalink
[api] run some delayed jobs in special queues
Browse files Browse the repository at this point in the history
* bug issue tracker job runs in extra queue to avoid that an external slow
  bugzilla server is slowin down processing all jobs
* binary tracker is doing heavy SQL load, so limit it to one job
  • Loading branch information
adrianschroeter committed Jul 9, 2014
1 parent 6c5f09f commit 0b9e501
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ReleaseNotes-2.6
Expand Up @@ -31,10 +31,13 @@ Features

* webui handles package sources supporting project links.

* optional binary package tracking, can be used to track released packages.
Esp. important for maintained products.

Changes on purpose:
===================

*
* some delayed jobs run in seperate queues now to avoid to block other jobs

Incompatible changes:
=====================
Expand Down
2 changes: 2 additions & 0 deletions dist/obsapidelayed
Expand Up @@ -57,6 +57,8 @@ case "$1" in
start)
echo -n "Starting OBS api delayed job handler "
run_in_api script/delayed_job.api.rb start -n $NUM
run_in_api script/delayed_job.api.rb --queue=releasetracking start -i 1000
run_in_api script/delayed_job.api.rb --queue=issuetracking start -i 1010
rc_status -v
echo -n "Starting OBS api clock daemon "
run_in_api $CLOCKWORKD -l -c config/clock.rb start
Expand Down
4 changes: 4 additions & 0 deletions src/api/app/jobs/update_released_binaries.rb
Expand Up @@ -2,6 +2,10 @@ class UpdateReleasedBinaries

attr_accessor :event

def self.job_queue
'releasetracking'
end

def initialize(event)
self.event = event
end
Expand Down
4 changes: 3 additions & 1 deletion src/api/app/models/event/base.rb
Expand Up @@ -148,7 +148,9 @@ def perform_create_jobs
self.create_jobs.each do |job|
eclass = job.to_s.camelize.safe_constantize
raise "#{job.to_s.camelize} does not map to a constant" if eclass.nil?
eclass.new(self).delay.perform
queue = {}
queue = { :queue => eclass.job_queue } if eclass.methods.include? :job_queue
eclass.new(self).delay(queue).perform
end
end

Expand Down
4 changes: 4 additions & 0 deletions src/api/lib/workers/update_issues.rb
@@ -1,5 +1,9 @@
class UpdateIssuesJob

def self.job_queue
'issuetracker'
end

def initialize
end

Expand Down

0 comments on commit 0b9e501

Please sign in to comment.