Sha256: 3c03af697c751ee63e7650ddfe2367cc04b76c597d83070fb2242a379ba6cbdd

Contents?: true

Size: 458 Bytes

Versions: 2

Compression:

Stored size: 458 Bytes

Contents

module EventSourcery
  module EventStore
    class SignalHandlingSubscriptionMaster
      def initialize
        @shutdown_requested = false
        setup_graceful_shutdown
      end

      def shutdown_if_requested
        throw :stop if @shutdown_requested
      end

      private

      def setup_graceful_shutdown
        %i(TERM INT).each do |signal|
          Signal.trap(signal) { @shutdown_requested = true }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
event_sourcery-0.14.0 lib/event_sourcery/event_store/signal_handling_subscription_master.rb
event_sourcery-0.13.0 lib/event_sourcery/event_store/signal_handling_subscription_master.rb