Make SnapshotWorker a Sidekiq based worker

openid
Marcin Kulik 11 years ago
parent 4943980baf
commit 49df9e9082

@ -5,7 +5,7 @@ class Api::AsciicastsController < ApplicationController
ac = Asciicast.new(params[:asciicast])
if ac.save
SnapshotQueue.push ac.id
SnapshotWorker.perform_async(ac.id)
render :text => asciicast_url(ac), :status => :created, :location => ac
else
render :text => ac.errors.full_messages, :status => 422

@ -1,13 +0,0 @@
class SnapshotQueue < GirlFriday::WorkQueue
include Singleton
def initialize
super(:snapshot_queue, :size => 3) do |asciicast_id|
SnapshotWorker.new.perform(asciicast_id)
end
end
def self.push *args
instance.push *args
end
end

@ -1,4 +1,6 @@
class SnapshotWorker
include Sidekiq::Worker
def perform(asciicast_id)
AsciicastSnapshotter.new(asciicast_id).run
end

Loading…
Cancel
Save