You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

enqueue.rb 609B

1234567891011121314151617181920
  1. #!/usr/bin/env ruby
  2. ENV['RAILS_ENV'] ||= 'development'
  3. require 'dotenv'
  4. Dotenv.load ".env.#{ENV['RAILS_ENV']}", '.env'
  5. if ENV['RAILS_ENV'] == 'development'
  6. DIR = File.dirname File.dirname File.expand_path __FILE__
  7. require File.join DIR, 'config/environment'
  8. ENV['RAILS_ENV'] = 'test'
  9. require 'sidekiq/testing/inline'
  10. end
  11. require 'sidekiq'
  12. redis = ENV['REDIS_URL']
  13. Sidekiq.configure_server { |c| c.redis = { url: redis } }
  14. Sidekiq.configure_client { |c| c.redis = { url: redis } }
  15. clazz, *args = ARGV
  16. clazz += 'Worker'
  17. Sidekiq::Client.push({ 'class' => clazz, 'args' => args, 'retry' => false })