-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Rejected jobs are still displayed as 'Queued' with gem 'sidekiq-status' on /sidekiq/statuses #564
Comments
I have my own page for viewing statuses. You can find a I know nothing about The more details the better. Otherwise, I can't really commit to fixing it. Late last year, someone explained really nicely what went wrong with Sidekiq::Apartment and I was able to quickly create a simple fix for their problem. |
Thanks for the fast reply, I can't seem to find the Locks tab you are talking, I will try to look deeper in the documentation. ** Setup **
require 'sidekiq/web'
require 'sidekiq-status/web'
Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq'
end
** Reproducing error ** Have a worker: class MyWorker
include Sidekiq::Worker
include Sidekiq::Status::Worker
sidekiq_options(
lock: :until_executed,
lock_args_method: ->(args) { [args.first] },
on_conflict: :reject
)
def perform(name)
puts "Running job #{name}..."
at(50)
sleep 10
at(100)
puts "Done..."
end
end
|
First of all, you might want to add the web extension for this gem as well: require 'sidekiq/web'
require 'sidekiq-status/web'
require 'sidekiq_unique_jobs/web'
Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq'
end |
From my investigation, this is due to the order of the middleware. To avoid confusion and teach people that the order of middleware is super important, I decided to not add the middleware automatically. This part deserves to be clear and up to the user. If you try the master branch (or clear your middleware first) you should be able to set everything up and verify locally. I added more information about this to the readme. |
Thanks for the fast reply / fixes. I updated to 7.0.0 (non-beta). I had never heard of the web extension you told me to add in routes. Can't seem to find anything about it. Also, it's giving me this error when I try to boot up the server:
So in the mean time, I removed the require 'sidekiq-unique-jobs/web' I updated my middleware chain to this
but I am still getting the same behavior. Sidekiq v6.1.2 |
Update, looks like doing the opposite inside middleware worked !
Sidekiq turned off, I queued 4 workers that sleeps for 5 seconds. I ran sidekiq and I got instantly this in the ui: 5 seconds later: Looks like it's all good :) ! |
Yeah sorry, I sloppy pasted the wrong code. There is a section in the README that has been corrected. |
@jamesst20 |
Hi @mhenrixon I believe the code example from readme is invalid. https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/README.md#sidekiq-status I noticed you said in readme something opposite to the code presented: Here is my working config: Sidekiq.configure_server do |config|
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes
end
config.server_middleware do |chain|
chain.add Sidekiq::Status::ServerMiddleware, expiration: 30.minutes # default
chain.add SidekiqUniqueJobs::Middleware::Server
end
SidekiqUniqueJobs::Server.configure(config)
end
Sidekiq.configure_client do |config|
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes
end
end |
Dangit @ArturT! I knew I rushed that a bit much. I'll copy your example to the README.md, thanks a bunch for letting me know! |
Ok, I updated the README again 😶 |
** Gems (all latest) **
** Description **
When I queue multiple jobs and that a lock rejects them, they are removed from the queue and added to processed as expected.
However, when visiting /sidekiq/statuses which is provided by the gem sidekiq-status, they are still marked as 'queued' excepted for the jobs that are not discarded.
** Expected behaviors **
Set them as completed or remove them
** Current behavior **
Show as queued while they are no longer queued.
The text was updated successfully, but these errors were encountered: