lib/tunemygc/spies/active_job.rb in tunemygc-1.0.34 vs lib/tunemygc/spies/active_job.rb in tunemygc-1.0.35
- old
+ new
@@ -3,15 +3,10 @@
require 'active_job'
module TuneMyGc
module Spies
class ActiveJob < TuneMyGc::Spies::Base
- def initialize
- @jobs_processed = 0
- @jobs_limit = nil
- end
-
def install
::ActiveJob::Base.__send__(:include, hooks_module)
TuneMyGc.log "hooked: active_job"
end
@@ -22,14 +17,14 @@
TuneMyGc.log "uninstalled active_job spy"
end
def check_uninstall
if ENV["RUBY_GC_TUNE_JOBS"]
- @jobs_limit ||= Integer(ENV["RUBY_GC_TUNE_JOBS"])
- @jobs_processed += 1
- if @jobs_processed == @jobs_limit
+ @limit ||= Integer(ENV["RUBY_GC_TUNE_JOBS"])
+ @processed += 1
+ if @processed == @limit
uninstall
- TuneMyGc.log "kamikaze after #{@jobs_processed} of #{@jobs_limit} jobs"
+ TuneMyGc.log "kamikaze after #{@processed} of #{@limit} jobs"
end
end
end
def hooks_module
\ No newline at end of file