Sha256: 94771794262674ac332c2a89ad386b27f6f71e2cddd5ce1f85c859f90af0db78

Contents?: true

Size: 759 Bytes

Versions: 5

Compression:

Stored size: 759 Bytes

Contents

require 'sidekiq/web'

module Sidetiq
  module Batching
    module Web
      VIEWS = File.expand_path('views', File.dirname(__FILE__))

      def self.registered(app)
        app.get "/batching" do
          @batches = Sidekiq::Batching::Batch.all
          erb File.read(File.join(VIEWS, 'index.erb')), locals: {view_path: VIEWS}
        end

        app.post "/batching/:name/delete" do
          worker_class, queue = Sidekiq::Batching::Batch.extract_worker_klass_and_queue(params['name'])
          batch = Sidekiq::Batching::Batch.new(worker_class, queue)
          batch.delete
          redirect "#{root_path}/batching"
        end
      end

    end
  end
end

Sidekiq::Web.register(Sidetiq::Batching::Web)
Sidekiq::Web.tabs["Batching"] = "batching"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sidekiq-batching-0.0.5 lib/sidekiq/batching/web.rb
sidekiq-batching-0.0.4 lib/sidekiq/batching/web.rb
sidekiq-batching-0.0.3 lib/sidekiq/batching/web.rb
sidekiq-batching-0.0.2 lib/sidekiq/batching/web.rb
sidekiq-batching-0.0.1 lib/sidekiq/batching/web.rb