Sha256: c53a477474e4903d689e183330a3d6ebb34d1652911f8e84191527075378377b

Contents?: true

Size: 636 Bytes

Versions: 9

Compression:

Stored size: 636 Bytes

Contents

require_relative 'base'

module Legion
  module Extensions
    module Actors
      class Loop
        include Concurrent::Async
        include Legion::Extensions::Actors::Base

        def initialize
          @loop = true
          async.run
        rescue StandardError => e
          Legion::Logging.error e
          Legion::Logging.error e.backtrace
        end

        def run
          action while @loop
        end

        def action(**_opts)
          Legion::Logging.warn 'An extension is using the default action for a loop'
        end

        def cancel
          @loop = false
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
legionio-1.2.1 lib/legion/extensions/actors/loop.rb
legionio-1.2.0 lib/legion/extensions/actors/loop.rb
legionio-0.4.3 lib/legion/extensions/actors/loop.rb
legionio-0.4.2 lib/legion/extensions/actors/loop.rb
legionio-0.4.1 lib/legion/extensions/actors/loop.rb
legionio-0.4.0 lib/legion/extensions/actors/loop.rb
legionio-0.3.2 lib/legion/extensions/actors/loop.rb
legionio-0.3.1 lib/legion/extensions/actors/loop.rb
legionio-0.3.0 lib/legion/extensions/actors/loop.rb