lib/backburner/allq_wrapper.rb in backburner-allq-1.0.37 vs lib/backburner/allq_wrapper.rb in backburner-allq-1.0.38
- old
+ new
@@ -40,17 +40,21 @@
attr_accessor :expireds
# Release count
attr_accessor :releases
- def initialize(wrapper, job_resposne)
+ # Release count
+ attr_accessor :special
+
+ def initialize(wrapper, job_response)
@client = wrapper
- @id = job_resposne.id
- @body = job_resposne.body
- @expireds = job_resposne.expireds
- @releases = job_resposne.releases
- @tube = job_resposne.tube.to_s
+ @id = job_response.id
+ @body = job_response.body
+ @expireds = job_response.expireds
+ @releases = job_response.releases
+ @tube = job_response.tube.to_s
+ @special = job_response.special.to_s if job_response.special
end
def done
@client.done(self)
end
@@ -91,16 +95,10 @@
@client = Allq::ActionsApi.new(raw_client)
@admin = Allq::AdminApi.new(raw_client)
@recent_times = []
end
- def speed
- return @recent_times.sum(0.0) / @recent_times.size if @recent_times.size > 0
-
- 0
- end
-
def touch(job)
@client.touch_put(job.id)
end
def done(job)
@@ -165,16 +163,10 @@
# return app_priority unless larger than 10
app_priority > 10 ? 5 : app_priority
end
- def log_result(job_result)
- puts("ALLQ-HTTP-JOB-ID=#{job_result.job_id}")
- rescue StandardError => e
- puts(e)
- end
-
def build_new_job(body, options)
adjusted_priority = map_priority(options[:pri] || 5)
ttl = options[:ttl] || options[:ttr] || DEFAULT_TIMEOUT
tube_name = options[:tube_name] || 'default'
@@ -193,10 +185,9 @@
def build_new_parent_job(body, options)
adjusted_priority = map_priority(options[:pri] || 5)
ttl = options[:ttl] || options[:ttr] || DEFAULT_TIMEOUT
tube_name = options[:tube_name] || 'default'
delay = options[:delay] || 0
- parent_id = options[:parent_id]
limit = options[:limit]
timeout = options[:timeout] || 3_600
run_on_timeout = options[:run_on_timeout] || false
Allq::NewParentJob.new(tube: tube_name,