Template of a custom feed generator service for the Bluesky network in Ruby

added option to start from a specific cursor

Changed files
+6 -2
app
bin
+2 -2
app/firehose_stream.rb
··· 8 8 require_relative 'models/subscription' 9 9 10 10 class FirehoseStream 11 - attr_accessor :show_progress, :log_status, :log_posts, :save_posts, :replay_events 11 + attr_accessor :start_cursor, :show_progress, :log_status, :log_posts, :save_posts, :replay_events 12 12 13 13 DEFAULT_JETSTREAM = 'jetstream2.us-east.bsky.network' 14 14 ··· 29 29 return if @sky 30 30 31 31 last_cursor = load_or_init_cursor 32 - cursor = @replay_events ? last_cursor : nil 32 + cursor = @replay_events ? (@start_cursor || last_cursor) : nil 33 33 34 34 @sky = sky = Skyfall::Jetstream.new(@service, { 35 35 cursor: cursor,
+4
bin/firehose
··· 33 33 puts " * Replaying missed events: [default: -nr in development, -r in production]" 34 34 puts " -r = pass a cursor param when connecting to replay any missed events" 35 35 puts " -nr = don't replay missed events" 36 + puts " -r12345 = start from this specific cursor" 36 37 end 37 38 38 39 firehose = FirehoseStream.new(ENV['FIREHOSE']) ··· 59 60 firehose.save_posts = false 60 61 when '-r' 61 62 firehose.replay_events = true 63 + when /^\-r(\d+)$/ 64 + firehose.replay_events = true 65 + firehose.start_cursor = $1.to_i 62 66 when '-nr' 63 67 firehose.replay_events = false 64 68 when '-h', '--help'