Sha256: 16f5a807c8ad13c0ecb252b7c5b2ab2e29b11d965a99bc735b797d2fc1c9a9cd

Contents?: true

Size: 684 Bytes

Versions: 13

Compression:

Stored size: 684 Bytes

Contents

# Usage (from the repo root):
# env FLIPPER_CLOUD_TOKEN=<token> bundle exec ruby examples/cloud/threaded.rb

require_relative "./cloud_setup"
require 'bundler/setup'
require 'flipper/cloud'

pids = 5.times.map do |n|
  fork {
    # Check every second to see if the feature is enabled
    threads = []
    5.times do
      threads << Thread.new do
        loop do
          sleep rand

          if Flipper[:stats].enabled?
            puts "#{Process.pid} #{Time.now.to_i} Enabled!"
          else
            puts "#{Process.pid} #{Time.now.to_i} Disabled!"
          end
        end
      end
    end
    threads.map(&:join)
  }
end

pids.each do |pid|
  Process.waitpid pid, 0
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
flipper-1.0.0 examples/cloud/forked.rb
flipper-1.0.0.pre examples/cloud/forked.rb
flipper-cloud-0.28.3 examples/cloud/forked.rb
flipper-cloud-0.28.2 examples/cloud/forked.rb
flipper-cloud-0.28.1 examples/cloud/forked.rb
flipper-cloud-0.28.0 examples/cloud/forked.rb
flipper-cloud-0.27.1 examples/cloud/forked.rb
flipper-cloud-0.27.0 examples/cloud/forked.rb
flipper-cloud-0.26.2 examples/cloud/forked.rb
flipper-cloud-0.26.1 examples/cloud/forked.rb
flipper-cloud-0.26.0 examples/cloud/forked.rb
flipper-cloud-0.26.0.rc2 examples/cloud/forked.rb
flipper-cloud-0.26.0.rc1 examples/cloud/forked.rb