Skip to content

Instantly share code, notes, and snippets.

@norman norman/Gemfile
Last active Jun 25, 2018

Embed
What would you like to do?
Delayed Job without Rails
ENV["DATABASE_URL"] = 'postgresql://postgres@localhost/my_database?encoding=utf8'
module Rails
extend self
def root
File.dirname(File.expand_path('..', __FILE__))
end
def logger
@logger ||= Logger.new $stdout
end
end
require 'bundler/setup'
require 'delayed_job'
require 'delayed/command'
require 'active_record'
Delayed::Worker.backend = :active_record
Delayed::Command.new(ARGV).daemonize
source 'https://rubygems.org'
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'pg'
$ time ./bin/delayed_job start
real 0m2.151s
user 0m1.763s
sys 0m0.343s
$ time ./bin/delayed_job stop
delayed_job: trying to stop process with pid 1337...
delayed_job: process with pid 1337 successfully stopped.
real 0m3.673s
user 0m1.724s
sys 0m0.222s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.