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