diff --git a/Changes.md b/Changes.md index 5c9cb6fd..efd1e88b 100644 --- a/Changes.md +++ b/Changes.md @@ -1,18 +1,16 @@ 1.2.0 ----------- -- Error backtraces can optionally be stored as part of the retry, +- Full or partial error backtraces can optionally be stored as part of the retry for display in the web UI if you aren't using an error service. [#155] ```ruby class Worker include Sidekiq::Worker - sidekiq_options :backtrace => true || 10 + sidekiq_options :backtrace => [true || 10] end ``` - -- Add Timeout middleware to optionally kill a worker after N seconds, - just configure like so. (blackgold9) +- Add Timeout middleware to optionally kill a worker after N seconds (blackgold9) ```ruby class HangingWorker @@ -25,12 +23,10 @@ end ``` - Fix delayed extensions not available in workers [#152] - - In test environments add the `#drain` class method to workers. This method executes all previously queued jobs. (panthomakos) - -- Sidekiq workers can be run inline during tests by requiring the - `sidekiq/testing/inline` file. (panthomakos) +- Sidekiq workers can be run inline during tests, just `require 'sidekiq/testing/inline'` (panthomakos) +- Queues can now be deleted from the Sidekiq web UI [#154] 1.1.4 ----------- diff --git a/Gemfile b/Gemfile index b987f215..2be6f322 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gemspec gem 'slim' gem 'sprockets' gem 'sass' -gem 'rails' +gem 'rails', '3.2.3' gem 'sqlite3' group :test do diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index dc7569cd..458abbdf 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -126,6 +126,14 @@ module Sidekiq slim :queue end + post "/queues/:name" do + Sidekiq.redis do |conn| + conn.del("queue:#{params[:name]}") + conn.srem("queues", params[:name]) + end + redirect root_path + end + get "/retries/:score" do halt 404 unless params[:score] @score = params[:score].to_f diff --git a/myapp/app/workers/hard_worker.rb b/myapp/app/workers/hard_worker.rb index f664a019..1e8f106d 100644 --- a/myapp/app/workers/hard_worker.rb +++ b/myapp/app/workers/hard_worker.rb @@ -1,6 +1,6 @@ class HardWorker include Sidekiq::Worker - sidekiq_options :timeout => 60 + sidekiq_options :timeout => 60, :backtrace => 5, :timeout => 20 def perform(name, count, salt) raise name if name == 'crash' diff --git a/web/assets/stylesheets/application.css b/web/assets/stylesheets/application.css index 245976da..f4aaff3c 100644 --- a/web/assets/stylesheets/application.css +++ b/web/assets/stylesheets/application.css @@ -9,3 +9,11 @@ body { background-color: #aaa; } +td form { + margin: 0; +} + +td form .btn { + margin: 0; +} + diff --git a/web/views/index.slim b/web/views/index.slim index d7fc953a..255d6674 100644 --- a/web/views/index.slim +++ b/web/views/index.slim @@ -38,11 +38,15 @@ tr th Queue th Size + th - queues.each do |(queue, size)| tr td - a href="queues/#{queue}" #{queue} + a href="#{root_path}queues/#{queue}" #{queue} td= size + td + form action="#{root_path}queues/#{queue}" method="post" + input.btn.btn-danger type="submit" name="delete" value="Delete" #retries.tab-pane table class="table table-striped table-bordered"