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-1.14.0 lib/bolt/notifier.rb
bolt-1.13.1 lib/bolt/notifier.rb
bolt-1.13.0 lib/bolt/notifier.rb
bolt-1.12.0 lib/bolt/notifier.rb
bolt-1.11.0 lib/bolt/notifier.rb
bolt-1.10.0 lib/bolt/notifier.rb
bolt-1.9.0 lib/bolt/notifier.rb
bolt-1.8.1 lib/bolt/notifier.rb
bolt-1.8.0 lib/bolt/notifier.rb
bolt-1.7.0 lib/bolt/notifier.rb
bolt-1.6.0 lib/bolt/notifier.rb
bolt-1.5.0 lib/bolt/notifier.rb
bolt-1.4.0 lib/bolt/notifier.rb
bolt-1.3.0 lib/bolt/notifier.rb
bolt-1.2.0 lib/bolt/notifier.rb
bolt-1.1.0 lib/bolt/notifier.rb
bolt-1.0.0 lib/bolt/notifier.rb
bolt-0.25.0 lib/bolt/notifier.rb
bolt-0.24.0 lib/bolt/notifier.rb
bolt-0.23.0 lib/bolt/notifier.rb