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.

added -n option to not save the report

+16 -14
+5 -5
opts.rb
··· 1 1 require 'optparse' 2 2 3 3 def parse_options(argv) 4 - options = { 5 - verbose: false, 6 - relays: nil, 7 - jetstreams: nil 8 - } 4 + options = {} 9 5 10 6 parser = OptionParser.new do |opts| 11 7 opts.banner = "Usage: #{$PROGRAM_NAME} [options]" ··· 22 18 opts.on('-j', '--jetstreams HOSTS', 'Only connect to these jetstreams; can be comma-separated or passed multiple times') do |hosts| 23 19 options[:jetstreams] ||= [] 24 20 options[:jetstreams] += hosts.split(',').map(&:strip).reject(&:empty?) 21 + end 22 + 23 + opts.on('-n', '--no-save', "Don't save report numbers to the database") do 24 + options[:dont_save] = true 25 25 end 26 26 27 27 opts.on('-v', '--verbose', 'Report the statistics to stdout during the test') do
+11 -9
run_test.rb
··· 97 97 result = JSON.parse(line) 98 98 puts "#{worker.host}: #{result.inspect}" if verbose 99 99 100 - Report.create!( 101 - start_time: test_start_time, 102 - duration: duration, 103 - host: worker.host, 104 - source_type: worker.type, 105 - users: result['users'], 106 - events: result['events'], 107 - connected: result['connected'] 108 - ) 100 + unless options[:dont_save] 101 + Report.create!( 102 + start_time: test_start_time, 103 + duration: duration, 104 + host: worker.host, 105 + source_type: worker.type, 106 + users: result['users'], 107 + events: result['events'], 108 + connected: result['connected'] 109 + ) 110 + end 109 111 end 110 112 rescue Interrupt 111 113 puts