Specific Field Update by Use Map Function


       


Rails Resque

gem 'resque-status'

bundle


1. ) app/workers/transcoder.rb

class Transcoder

  include Resque::Plugins::Status

  @queue = :transcoder

  def perform

    puts "transcoder starting..."

  end

end

2.) config/initializers/resque.rb



require 'redis'

require 'resque/status_server'

$redis = Redis.new

RS=Resque::Plugins::Status

Resque::Plugins::Status::Hash.expire_in = (48 * 60 * 60) # 2 days in seconds



3.)  lib/resque.rake



require 'bundler/setup'

Bundler.require(:default)

# require 'nish-news'

require 'resque/tasks'

task "resque:setup" do

      ENV['QUEUE'] = '*'

      Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }

end



4. ) Procfile



web: bundle exec rails s -p 3000

worker1: bundle exec rake environment resque:work QUEUE='transcoder'


and foreman start






https://gist.github.com/muratatak77/bbe743e379add276cf59cc1fc90b7efb

Comments

Popular posts from this blog

Design a notification system

NETFLIX HIGH-LEVEL SYSTEM DESIGN

URL Shortener System Design