- Rename
singleton_class?
method to allow for usage with Ruby 3
- Add a blocking
SuckerPunch::Queue.wait
which waits for all queues to become idle.
- Opt for keyword parsing using
ruby2_keywords
for compatibility.
- Add support for keyword arguments in ruby
>= 3.0
. More details in release notes.
- Relax versioning constraint of
concurrent-ruby
to make way for 1.1 release
-
Add
max_jobs
configuration option to set the maximum number of tasks that may be waiting in the work queueclass 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
- Better initialization of variables and names to remove warnings
- Rewrite shutdown strategy to fix bug related to premature shutdown when only 1 job is in enqueued when a job has more than 1 worker
- Don't consider global shutdown bool when exhausting the queue during
shutdown. This led to
shutdown_timeout
not being respected when processing remaining jobs left in the queue with a highshutdown_timeout
.
- Remove scripts from
bin/
-
Refactor internals to use
concurrent-ruby
-
Yield more exception details to handler. The new syntax allows you to setup a global exception with the following syntax:
# ex => The caught exception object # klass => The job class # args => An array of the args passed to the job SuckerPunch.exception_handler = -> (ex, klass, args) { ExceptionNotifier.notify_exception(ex) }
-
Invoke asynchronous job via
perform_async
andperform_in
class method (backwards incompatible change):LogJob.perform_async("login") LogJob.perform_in(60, "login") # `perform` will be executed 60 sec. later
-
Drop support for Ruby
< 2.0
-
Allow shutdown timeout to be set (default is 8 sec.):
SuckerPunch.shutdown_timeout = 15 # time in seconds
- Update to use Celluloid
0.17.2
- Removed the
SuckerPunch.clear_queues
method
- Lock to Celluloid
0.16.0
due to0.16.1
being yanked
- Allow number of workers to be up to and including 200
- Don't clear out non-Sucker Punch Celluloid registry on boot #113
- Added Rails generate task to create a job from the command line
- Remove extraneous conditions in core extension
underscore
- Require
sucker_punch
before inline testing library to ensure changes stick
- Update to use Celluloid
0.16
- Go back to Celluloid
0.15.2
since it's not production ready
- Update to use Celluloid
0.16
- Delegate to Celluloid's exception handler
- Move
to_prepare
callback in Railtie out of initializer
- Fix superclass for
testing/inline
module
- Track instantiated queues through Celluloid registry
- Clear Celluloid registry on every Rails request in Development
- Update Celluloid dependency to 0.15.1
- Fix how workers are defined on the Job so that jobs can be safely subclassed
- Constrain workers when creating a queue to raise more helpful exceptions
- Add
workers
method to job to specify number of Celluloid pool workers
- Removed the need for a configuration initializer
- include
SuckerPunch::Job
instead ofSuckerPunch::Worker
- Use standard Ruby job class instantiation to perform a job (ie. LogJob.new.async.perform)
- Add
SuckerPunch.logger
- Add
SuckerPunch.logger=
- Set SuckerPunch logger to Rails.logger within a Rails application
SuckerPunch::Queue#size
now returns the number of messages enqueuedSuckerPunch::Queue#workers
now returns the number of workers in the queue- Update Celluloid dependency
- Remove
size
option when defining a queue, preferworkers
- Update Celluloid dependency
- Prefer
workers
stat method oversize
- Update config to use
workers
instead ofsize
old config:
# config/initializers/sucker_punch.rb
SuckerPunch.config do
queue name: :log_queue, worker: LogWorker, size: 10
end
new config:
# config/initializers/sucker_punch.rb
SuckerPunch.config do
queue name: :log_queue, worker: LogWorker, workers: 10
end
- Add testing library to stub out workers (see testing section in README)
- Fix location of inline testing library
spec/spec_helper.rb
require 'sucker_punch/testing/inline'
SuckerPunch::Queue[:log_queue].async.perform("login") # => SYNCHRONOUS
- Now includes a testing library that will run all jobs synchronously.
spec/spec_helper.rb
require 'sucker_punch/testing'
SuckerPunch::Queue[:log_queue].async.perform("login") # => SYNCHRONOUS