lib/rocket_job/worker.rb in rocketjob-3.0.0.rc2 vs lib/rocket_job/worker.rb in rocketjob-3.0.0.rc3
- old
+ new
@@ -39,15 +39,15 @@
@shutdown = Concurrent::AtomicBoolean.new(false)
else
@shutdown = false
end
@name = "#{server_name}:#{id}"
- @thread = Thread.new { run } unless inline
@re_check_seconds = re_check_seconds || 60
@re_check_start = Time.now
@filter = filter || {}
@current_filter = @filter.dup
+ @thread = Thread.new { run } unless inline
end
if defined?(Concurrent::JavaAtomicBoolean) || defined?(Concurrent::CAtomicBoolean)
# Tells this worker to shutdown as soon the current job/slice is complete
def shutdown!
@@ -98,10 +98,10 @@
# Returns [Boolean] whether any job was actually processed
def process_available_jobs
# Only clear out the current_filter after every `re_check_seconds`
time = Time.now
if (time - @re_check_start) > re_check_seconds.to_f
- @recheck_start = time
+ @re_check_start = time
self.current_filter = filter.dup
end
processed = false
while (job = Job.rocket_job_next_job(name, current_filter)) && !shutdown?