Sha256: 8819d2e573e7b2d7ef2008c409f9dfe3a4961767fb5d386b0aaec520afbeda3a

Contents?: true

Size: 599 Bytes

Versions: 4

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module CLI
    module Commands
      class StopSubscriptionsCommand < BaseCommand
        # @return [Integer] exit code
        def call
          pid = Utils.read_pid(options.pid_path)&.to_i
          if pid && pid > 0
            PgEventstore.logger&.info("Stopping process #{pid}.")
            Process.kill('TERM', pid)
            return ExitCodes::SUCCESS
          end

          PgEventstore.logger&.error("Pid file #{options.pid_path.inspect} does not exist or empty.")
          ExitCodes::ERROR
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pg_eventstore-1.9.0 lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb
pg_eventstore-1.8.0 lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb
pg_eventstore-1.7.0 lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb
pg_eventstore-1.6.0 lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb