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.

allow overriding relays and/or jetstreams on command line

+22 -4
+13 -1
opts.rb
··· 2 2 3 3 def parse_options(argv) 4 4 options = { 5 - verbose: false 5 + verbose: false, 6 + relays: nil, 7 + jetstreams: nil 6 8 } 7 9 8 10 parser = OptionParser.new do |opts| ··· 10 12 11 13 opts.on('-d', '--duration SECONDS', Integer, 'Duration of the test in seconds') do |seconds| 12 14 options[:duration] = seconds 15 + end 16 + 17 + opts.on('-r', '--relays HOSTS', 'Only connect to these relays; can be comma-separated or passed multiple times') do |hosts| 18 + options[:relays] ||= [] 19 + options[:relays] += hosts.split(',').map(&:strip).reject(&:empty?) 20 + end 21 + 22 + opts.on('-j', '--jetstreams HOSTS', 'Only connect to these jetstreams; can be comma-separated or passed multiple times') do |hosts| 23 + options[:jetstreams] ||= [] 24 + options[:jetstreams] += hosts.split(',').map(&:strip).reject(&:empty?) 13 25 end 14 26 15 27 opts.on('-v', '--verbose', 'Report the statistics to stdout during the test') do
+9 -3
run_test.rb
··· 9 9 SOURCES = 'config/sources.yml' 10 10 11 11 config = YAML.load(File.read(SOURCES)) 12 + options = parse_options(ARGV) 12 13 13 - relays = config['relays'] || [] 14 - jetstreams = config['jetstreams'] || [] 14 + if options[:relays] || options[:jetstreams] 15 + relays = options[:relays] || [] 16 + jetstreams = options[:jetstreams] || [] 17 + else 18 + relays = config['relays'] || [] 19 + jetstreams = config['jetstreams'] || [] 20 + end 21 + 15 22 maxlen = (relays + jetstreams).map(&:length).max 16 23 17 - options = parse_options(ARGV) 18 24 verbose = options[:verbose] 19 25 duration = options[:duration] || config['duration']&.to_i || 60 * 15 20 26