Class: Sidekiq::Mcp::Tools::RemoveJobTool
- Inherits:
-
Sidekiq::Mcp::Tool
- Object
- Sidekiq::Mcp::Tool
- Sidekiq::Mcp::Tools::RemoveJobTool
- Defined in:
- lib/sidekiq/mcp/tools/remove_job_tool.rb
Instance Method Summary collapse
Methods inherited from Sidekiq::Mcp::Tool
arguments, #call, description, schema_to_json_schema, to_tool_definition
Instance Method Details
#perform(jid:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sidekiq/mcp/tools/remove_job_tool.rb', line 16 def perform(jid:) # Try to find and remove from retry set retry_set = Sidekiq::RetrySet.new if (job = retry_set.find_job(jid)) job.delete return "Job #{jid} removed from retry set" end # Try to find and remove from scheduled set scheduled_set = Sidekiq::ScheduledSet.new if (job = scheduled_set.find_job(jid)) job.delete return "Job #{jid} removed from scheduled set" end # Try to find and remove from dead set dead_set = Sidekiq::DeadSet.new if (job = dead_set.find_job(jid)) job.delete return "Job #{jid} removed from dead set" end # Try to find and remove from queues Sidekiq::Queue.all.each do |queue| if (job = queue.find_job(jid)) job.delete return "Job #{jid} removed from queue '#{queue.name}'" end end "Job #{jid} not found in any queue or set" end |