Skip to content

Instantly share code, notes, and snippets.

@adamruzicka
Created May 4, 2021 10:22
Show Gist options
  • Save adamruzicka/950f005f0a817fd08dfaed635912b3b7 to your computer and use it in GitHub Desktop.
Save adamruzicka/950f005f0a817fd08dfaed635912b3b7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# frozen_string_literal: true
# examples/excessive_logging.rb
# Reproducer for https://bugzilla.redhat.com/show_bug.cgi?id=1877917
# Run with something like
# for i in 1 2 5 10 50 100 500 1000; do echo -n "$i: "; COUNT=$i bundle exec ruby examples/excessive_logging.rb >/dev/null 2>&1 | wc -l -c | column -t; done
require_relative 'example_helper'
class AnAction < Dynflow::Action
def run(event = nil)
output[:counter] ||= (ENV['COUNT'] || 100).to_i
if output[:counter] > 0
output[:counter] -= 1
plan_event(output[:counter])
suspend
else
raise "Halt"
end
end
end
if $0 == __FILE__
ExampleHelper.world.action_logger.level = 3
ExampleHelper.world.logger.level = 3
ExampleHelper.world.trigger(AnAction).finished.wait
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment