Sha256: c50eb4dd65d3f800650caae0c659ce129e2bde6e74b3ccbb760b930f1b202c9f

Contents?: true

Size: 437 Bytes

Versions: 5

Compression:

Stored size: 437 Bytes

Contents

# frozen_string_literal: true

module Bolt
  class Notifier
    def initialize(executor = nil)
      # lazy-load expensive gem code
      require 'concurrent'

      @executor = executor || Concurrent::SingleThreadExecutor.new
    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

5 entries across 5 versions & 1 rubygems

Version Path
bolt-1.19.0 lib/bolt/notifier.rb
bolt-1.18.0 lib/bolt/notifier.rb
bolt-1.17.0 lib/bolt/notifier.rb
bolt-1.16.0 lib/bolt/notifier.rb
bolt-1.15.0 lib/bolt/notifier.rb