Repository: rails/rails
File: activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb (Ruby)

Code before:
# frozen_string_literal: true

gem "sidekiq", ">= 4.1.0"
require "sidekiq"

module ActiveJob
  module QueueAdapters
    # = Sidekiq adapter for Active Job
    #
    # Simple, efficient background processing for Ruby. Sidekiq uses threads to
    # handle many jobs at the same time in the same process. It does not
    # require \Rails but will integrate tightly with it to make background
    # processing dead simple.
    #
    # Read more about Sidekiq {here}[http://sidekiq.org].
    #
    # To use Sidekiq set the queue_adapter config to +:sidekiq+.
    #
    #   Rails.application.config.active_job.queue_adapter = :sidekiq
    class SidekiqAdapter < AbstractAdapter
      def check_adapter
        ActiveJob.deprecator.warn <<~MSG.squish
          The `sidekiq` adapter is deprecated and will be removed in Rails 8.1.
          Please upgrade `sidekiq` gem to version 8.0 or later.
        MSG
      end

      def enqueue(job) # :nodoc:
        job.provider_job_id = JobWrapper.set(
          wrapped: job.class,
          queue: job.queue_name
        ).perform_async(job.serialize)
      end

      def enqueue_at(job, timestamp) # :nodoc:
        job.provider_job_id = JobWrapper.set(
          wrapped: job.class,
          queue: job.queue_name,
        ).perform_at(timestamp, job.serialize)
      end

      def enqueue_all(jobs) # :nodoc:
        enqueued_count = 0
        jobs.group_by(&:class).each do |job_class, same_class_jobs|
          same_class_jobs.group_by(&:queue_name).each do |queue, same_class_and_queue_jobs|
            immediate_jobs, scheduled_jobs = same_class_and_queue_jobs.partition { |job| job.scheduled_at.nil? }

            if immediate_jobs.any?
              jids = Sidekiq::Client.push_bulk(

Review comment (suggestion):
```suggestion
          The built-in `sidekiq` adapter is deprecated and will be removed in Rails 8.1.
          Please upgrade `sidekiq` gem to version 8.0 or later to use the `sidekiq` gem's adapter.
```

Same thing here, feel free to tweak my suggestion further.

Code after:
# frozen_string_literal: true

gem "sidekiq", ">= 4.1.0"
require "sidekiq"

module ActiveJob
  module QueueAdapters
    # = Sidekiq adapter for Active Job
    #
    # Simple, efficient background processing for Ruby. Sidekiq uses threads to
    # handle many jobs at the same time in the same process. It does not
    # require \Rails but will integrate tightly with it to make background
    # processing dead simple.
    #
    # Read more about Sidekiq {here}[http://sidekiq.org].
    #
    # To use Sidekiq set the queue_adapter config to +:sidekiq+.
    #
    #   Rails.application.config.active_job.queue_adapter = :sidekiq
    class SidekiqAdapter < AbstractAdapter
      def initialize(*) # :nodoc:
        @stopping = false

        Sidekiq.configure_server do |config|
          config.on(:quiet) { @stopping = true }
        end

        Sidekiq.configure_client do |config|
          config.on(:quiet) { @stopping = true }
        end
      end

      def check_adapter
        ActiveJob.deprecator.warn <<~MSG.squish
          The built-in `sidekiq` adapter is deprecated and will be removed in Rails 8.2.
          Please upgrade `sidekiq` gem to version 7.3.3 or later to use the `sidekiq` gem's adapter.
        MSG
      end

      def enqueue(job) # :nodoc:
        job.provider_job_id = JobWrapper.set(
          wrapped: job.class,
          queue: job.queue_name
        ).perform_async(job.serialize)
      end

      def enqueue_at(job, timestamp) # :nodoc:
        job.provider_job_id = JobWrapper.set(
          wrapped: job.class,