Sucker Punch v2.1.0 Release Notes

Release Date: 2018-08-17 // over 5 years ago
    • ➕ Add max_jobs configuration option to set the maximum number of tasks that may be waiting in the work queue

      class JobWithLimit
        include SuckerPunch::Job
        max_jobs 2
      
        def perform(data)
          # work...
        end
      end
      
      10.times do
        begin
          JobWithLimit.perform_async('work') }
        rescue Concurrent::RejectedExecutionError => e
          # Queue maxed out, this job didn't get queued
        end
      end