Sha256: 3c33215190ee427ba14b4b8c3159e10c58e34e10416f22ddde23a181067c45af

Contents?: true

Size: 788 Bytes

Versions: 61

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module GoodJob # :nodoc:
  class Notifier # :nodoc:
    # Extends the Notifier to register the process in the database.
    module ProcessRegistration
      extend ActiveSupport::Concern

      included do
        set_callback :listen, :after, :register_process
        set_callback :unlisten, :after, :deregister_process
      end

      # Registers the current process.
      def register_process
        GoodJob::Process.with_connection(connection) do
          GoodJob::Process.cleanup
          @process = GoodJob::Process.register
        end
      end

      # Deregisters the current process.
      def deregister_process
        GoodJob::Process.with_connection(connection) do
          @process&.deregister
        end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
good_job-3.6.0 lib/good_job/notifier/process_registration.rb
good_job-3.5.1 lib/good_job/notifier/process_registration.rb
good_job-3.5.0 lib/good_job/notifier/process_registration.rb
good_job-3.4.8 lib/good_job/notifier/process_registration.rb
good_job-3.4.7 lib/good_job/notifier/process_registration.rb
good_job-3.4.6 lib/good_job/notifier/process_registration.rb
good_job-3.4.5 lib/good_job/notifier/process_registration.rb
good_job-3.4.4 lib/good_job/notifier/process_registration.rb
good_job-3.4.3 lib/good_job/notifier/process_registration.rb
good_job-3.4.2 lib/good_job/notifier/process_registration.rb
good_job-3.4.1 lib/good_job/notifier/process_registration.rb
good_job-3.4.0 lib/good_job/notifier/process_registration.rb
good_job-3.3.3 lib/good_job/notifier/process_registration.rb
good_job-3.3.2 lib/good_job/notifier/process_registration.rb
good_job-3.3.1 lib/good_job/notifier/process_registration.rb
good_job-3.3.0 lib/good_job/notifier/process_registration.rb
good_job-3.2.0 lib/good_job/notifier/process_registration.rb
good_job-3.1.0 lib/good_job/notifier/process_registration.rb
good_job-3.0.2 lib/good_job/notifier/process_registration.rb
good_job-3.0.1 lib/good_job/notifier/process_registration.rb