resque-job-stats icon indicating copy to clipboard operation
resque-job-stats copied to clipboard

Jobs run twice to measure duration for duration and history modules

Open jeniaefimov opened this issue 4 years ago • 0 comments

In modules Resque::Plugins::JobStats::Duration and Resque::Plugins::JobStats::History I see two different callbacks that start from around_perform_? From what I understand it means that job run twice to measure the time, is it intentional behaviour?

I'm trying to make this gem work with ActiveJob and this is how I can make around_perform_ callbacks work

         base.around_perform do |job, block|
            job.class.methods.select do |meth|
              meth.to_s.start_with?("around_perform_")
            end.each do |meth|
              job.class.send(meth) { block.call }
            end
          end

but in this case if we have more than 1 callback we call job few times. Could we discuss it?

jeniaefimov avatar Nov 23 '20 11:11 jeniaefimov