1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00
endofunky--sidetiq/lib/sidetiq.rb
Simon Fröhler 7bec408416 Makes Sidekiq compatible to Sidekiq 3.5.0 and Celluloid 0.17
Fixes "uninitialized constant Celluloid::SupervisionGroup" error on sidekiq start:

* require 'celluloid' instead of 'celluloid/current' in lib/sidetiq.rb
* Supervisor inherits from Celluloid::Supervision::Container instead
  of Celluloid::SupervisionGroup and uses new supervise method signature

More details about the changes in Celluloid can be found here:
https://github.com/celluloid/celluloid/wiki/DEPRECATION-WARNING

Fixes tests to work with Sidekiq 3.5.0:

* Use created_at instead of enqueued_at it the tests:
  > Set a created_at attribute when jobs are created, set enqueued_at only
    when they go into a queue. Fixes invalid latency calculations with
    scheduled jobs. [#2373, mrsimo]

  https://github.com/mperham/sidekiq/blob/master/Changes.md#340

* Set ENV['RACK_ENV'] = 'test' in test/helper.rb to fix tests to fix tests
  to work with Sidekiq 3.4.2 update:
  > Fix CSRF vulnerability in Web UI, thanks to Egor Homakov for reporting. [#2422]

  https://github.com/mperham/sidekiq/blob/master/Changes.md#342
  https://github.com/mperham/sidekiq/pull/2422/files

fixes #140
2015-09-08 15:45:17 +02:00

66 lines
1.2 KiB
Ruby

# stdlib
require 'ostruct'
require 'singleton'
require 'socket'
require 'time'
# gems
require 'ice_cube'
require 'sidekiq'
require 'celluloid/current'
# internal
require 'sidetiq/config'
require 'sidetiq/logging'
require 'sidetiq/api'
require 'sidetiq/subclass_tracking'
require 'sidetiq/clock'
require 'sidetiq/handler'
require 'sidetiq/lock/meta_data'
require 'sidetiq/lock/redis'
require 'sidetiq/schedule'
require 'sidetiq/schedulable'
require 'sidetiq/version'
# middleware
require 'sidetiq/middleware/history'
# actor topology
require 'sidetiq/actor'
require 'sidetiq/actor/clock'
require 'sidetiq/actor/handler'
require 'sidetiq/supervisor'
# The Sidetiq namespace.
module Sidetiq
include Sidetiq::API
# Expose all instance methods as singleton methods.
extend self
class << self
# Public: Setter for the Sidetiq logger.
attr_writer :logger
end
# Public: Reader for the Sidetiq logger.
#
# Defaults to `Sidekiq.logger`.
def logger
@logger ||= Sidekiq.logger
end
# Public: Returns the Sidetiq::Clock actor.
def clock
Sidetiq::Supervisor.clock
end
# Public: Returns a Sidetiq::Handler worker.
def handler
Sidetiq::Supervisor.handler
end
end
if Sidekiq.server?
Sidetiq::Supervisor.run!
end