Sha256: ed66036bd8dc768236933f507102601a626adb4c9aefe8c48e7870db9492515e

Contents?: true

Size: 387 Bytes

Versions: 41

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

require 'concurrent'

module Bolt
  class Notifier
    def initialize(executor = Concurrent::SingleThreadExecutor.new)
      @executor = executor
    end

    def notify(callback, event)
      @executor.post do
        callback.call(event)
      end
    end

    def shutdown
      @executor.shutdown
      @executor.wait_for_termination
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
bolt-0.22.0 lib/bolt/notifier.rb
bolt-0.21.8 lib/bolt/notifier.rb
bolt-0.21.7 lib/bolt/notifier.rb
bolt-0.21.6 lib/bolt/notifier.rb
bolt-0.21.5 lib/bolt/notifier.rb
bolt-0.21.4 lib/bolt/notifier.rb
bolt-0.21.3 lib/bolt/notifier.rb
bolt-0.21.2 lib/bolt/notifier.rb
bolt-0.21.1 lib/bolt/notifier.rb
bolt-0.21.0 lib/bolt/notifier.rb
bolt-0.20.7 lib/bolt/notifier.rb
bolt-0.20.6 lib/bolt/notifier.rb
bolt-0.20.5 lib/bolt/notifier.rb
bolt-0.20.3 lib/bolt/notifier.rb
bolt-0.20.2 lib/bolt/notifier.rb
bolt-0.20.0 lib/bolt/notifier.rb
bolt-0.19.1 lib/bolt/notifier.rb
bolt-0.19.0 lib/bolt/notifier.rb
bolt-0.18.2 lib/bolt/notifier.rb
bolt-0.18.1 lib/bolt/notifier.rb