A tool for measuring the coverage of Bluesky/ATProto relays
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

print updates only if -v is passed

+26 -5
+26 -5
run_test.rb
··· 11 11 relays = config['relays'] 12 12 duration = config['duration']&.to_i || 60 * 15 13 13 maxlen = relays.map(&:length).max 14 + verbose = false 15 + 16 + def print_help 17 + puts "Usage: #{$PROGRAM_NAME} [-v]" 18 + end 19 + 20 + ARGV.each do |param| 21 + case param 22 + when '-h', '--help' 23 + print_help 24 + exit 0 25 + when '-v', '--verbose' 26 + verbose = true 27 + else 28 + puts "Unknown option: #{param}" 29 + print_help 30 + exit 1 31 + end 32 + end 14 33 15 34 Worker = Struct.new(:host, :pid) 16 35 workers = [] ··· 27 46 events += 1 28 47 users << msg.did 29 48 30 - now = Time.now.to_i / 60 31 - if now > minute 32 - puts "[#{Time.now}] #{host.ljust(maxlen)} | events: #{events.to_s.ljust(8)} | users: #{users.size}" 33 - minute = now 49 + if verbose 50 + now = Time.now.to_i / 60 51 + if now > minute 52 + puts "[#{Time.now}] #{host.ljust(maxlen)} | events: #{events.to_s.ljust(8)} | users: #{users.size}" 53 + minute = now 54 + end 34 55 end 35 56 end 36 57 37 58 sky.on_connecting { puts "[#{Time.now}] #{host}: Connecting..." } 38 59 sky.on_connect { puts "[#{Time.now}] #{host}: Connected ✓" } 39 - 60 + 40 61 trap('SIGINT') { sky.disconnect } 41 62 42 63 sky.connect