In my event service I'm trying to delete a job, but I see this:
NoMethodError: undefined method `jobs' for module Sidekiq::Job
I know that it is possible to delete using ScheduledSet, but I cannot write tests using it.Service:
# frozen_string_literal: truemodule Api module V1 module Events class Destroy < BaseService attr_reader :event def initialize(event:) @event = event end def call cancel_notification event.destroy success!(event) end private def cancel_notification return if event.notification_job_id.blank? || Sidekiq::Worker.jobs.empty? Sidekiq::Job.jobs.reject! { |job| job["jid"] == event.notification_job_id } end end end endend
I tried to use Sidekiq::Workers, Sidekiq::Worker(alias) but see the same thing