ld-eventsource 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/ld-eventsource/client.rb +48 -46
- data/lib/ld-eventsource/events.rb +5 -1
- data/lib/ld-eventsource/impl/backoff.rb +5 -1
- data/lib/ld-eventsource/impl/buffered_line_reader.rb +82 -0
- data/lib/ld-eventsource/impl/event_parser.rb +13 -7
- data/lib/ld-eventsource/version.rb +1 -1
- metadata +17 -28
- data/.circleci/config.yml +0 -51
- data/.gitignore +0 -16
- data/.ldrelease/config.yml +0 -17
- data/CHANGELOG.md +0 -20
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -67
- data/ld-eventsource.gemspec +0 -30
- data/scripts/gendocs.sh +0 -12
- data/scripts/release.sh +0 -30
- data/spec/backoff_spec.rb +0 -52
- data/spec/client_spec.rb +0 -429
- data/spec/event_parser_spec.rb +0 -100
- data/spec/http_stub.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76ed80d3fefe60b6a147769dc1b44b0dfd7fe5b6841ff84655ae86764def70b9
|
4
|
+
data.tar.gz: cf24cff61716e4487d74023e09be18a516232a198aabcda2742fb8ec8de9de72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 329c044114376d9d618e37a138b7c99dc5c4f00baa3d22ea72ce88309deec8bd22a62c0513a362223542f9ddfa5aaae0413e14bbf336ef943a90e0374d2d9c89
|
7
|
+
data.tar.gz: 9110b5daa08a3c7fb04bb432527feaf4bee5e67d02b215621c89546ffd0a4da98c14a9618cdf4040474afe1649db777996547bfb502512930a3b364f05dd57c1
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "ld-eventsource/impl/backoff"
|
2
|
+
require "ld-eventsource/impl/buffered_line_reader"
|
2
3
|
require "ld-eventsource/impl/event_parser"
|
3
4
|
require "ld-eventsource/events"
|
4
5
|
require "ld-eventsource/errors"
|
@@ -128,11 +129,12 @@ module SSE
|
|
128
129
|
read: read_timeout,
|
129
130
|
connect: connect_timeout
|
130
131
|
})
|
131
|
-
@
|
132
|
+
@cxn = nil
|
132
133
|
@lock = Mutex.new
|
133
134
|
|
134
135
|
@backoff = Impl::Backoff.new(reconnect_time || DEFAULT_RECONNECT_TIME, MAX_RECONNECT_TIME,
|
135
136
|
reconnect_reset_interval: reconnect_reset_interval)
|
137
|
+
@first_attempt = true
|
136
138
|
|
137
139
|
@on = { event: ->(_) {}, error: ->(_) {} }
|
138
140
|
@last_id = last_event_id
|
@@ -190,51 +192,27 @@ module SSE
|
|
190
192
|
end
|
191
193
|
end
|
192
194
|
|
195
|
+
#
|
196
|
+
# Tests whether the client has been shut down by a call to {Client#close}.
|
197
|
+
#
|
198
|
+
# @return [Boolean] true if the client has been shut down
|
199
|
+
#
|
200
|
+
def closed?
|
201
|
+
@stopped.value
|
202
|
+
end
|
203
|
+
|
193
204
|
private
|
194
205
|
|
195
206
|
def reset_http
|
196
207
|
@http_client.close if !@http_client.nil?
|
197
|
-
|
198
|
-
@buffer = ""
|
199
|
-
end
|
200
|
-
|
201
|
-
def read_lines
|
202
|
-
Enumerator.new do |gen|
|
203
|
-
loop do
|
204
|
-
line = read_line
|
205
|
-
break if line.nil?
|
206
|
-
gen.yield line
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
def read_line
|
212
|
-
loop do
|
213
|
-
@lock.synchronize do
|
214
|
-
i = @buffer.index(/[\r\n]/)
|
215
|
-
if !i.nil? && !(i == @buffer.length - 1 && @buffer[i] == "\r")
|
216
|
-
i += 1 if (@buffer[i] == "\r" && @buffer[i + 1] == "\n")
|
217
|
-
return @buffer.slice!(0, i + 1).force_encoding(Encoding::UTF_8)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
return nil if !read_chunk_into_buffer
|
221
|
-
end
|
208
|
+
close_connection
|
222
209
|
end
|
223
210
|
|
224
|
-
def
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
data = @cxn.readpartial
|
229
|
-
rescue HTTP::TimeoutError
|
230
|
-
# We rethrow this as our own type so the caller doesn't have to know the httprb API
|
231
|
-
raise Errors::ReadTimeoutError.new(@read_timeout)
|
211
|
+
def close_connection
|
212
|
+
@lock.synchronize do
|
213
|
+
@cxn.connection.close if !@cxn.nil?
|
214
|
+
@cxn = nil
|
232
215
|
end
|
233
|
-
return false if data == nil
|
234
|
-
@buffer << data
|
235
|
-
# We are piping the content through the parser so that it can handle things like chunked
|
236
|
-
# encoding for us. The content ends up being appended to @buffer via our callback.
|
237
|
-
true
|
238
216
|
end
|
239
217
|
|
240
218
|
def default_logger
|
@@ -246,13 +224,16 @@ module SSE
|
|
246
224
|
|
247
225
|
def run_stream
|
248
226
|
while !@stopped.value
|
249
|
-
|
227
|
+
close_connection
|
250
228
|
begin
|
251
|
-
|
229
|
+
resp = connect
|
230
|
+
@lock.synchronize do
|
231
|
+
@cxn = resp
|
232
|
+
end
|
252
233
|
# There's a potential race if close was called in the middle of the previous line, i.e. after we
|
253
234
|
# connected but before @cxn was set. Checking the variable again is a bit clunky but avoids that.
|
254
235
|
return if @stopped.value
|
255
|
-
read_stream(
|
236
|
+
read_stream(resp) if !resp.nil?
|
256
237
|
rescue => e
|
257
238
|
# When we deliberately close the connection, it will usually trigger an exception. The exact type
|
258
239
|
# of exception depends on the specific Ruby runtime. But @stopped will always be set in this case.
|
@@ -274,7 +255,8 @@ module SSE
|
|
274
255
|
def connect
|
275
256
|
loop do
|
276
257
|
return if @stopped.value
|
277
|
-
interval = @backoff.next_interval
|
258
|
+
interval = @first_attempt ? 0 : @backoff.next_interval
|
259
|
+
@first_attempt = false
|
278
260
|
if interval > 0
|
279
261
|
@logger.info { "Will retry connection after #{'%.3f' % interval} seconds" }
|
280
262
|
sleep(interval)
|
@@ -317,7 +299,27 @@ module SSE
|
|
317
299
|
# it can automatically reset itself if enough time passes between failures.
|
318
300
|
@backoff.mark_success
|
319
301
|
|
320
|
-
|
302
|
+
chunks = Enumerator.new do |gen|
|
303
|
+
loop do
|
304
|
+
if @stopped.value
|
305
|
+
break
|
306
|
+
else
|
307
|
+
begin
|
308
|
+
data = cxn.readpartial
|
309
|
+
# readpartial gives us a string, which may not be a valid UTF-8 string because a
|
310
|
+
# multi-byte character might not yet have been fully read, but BufferedLineReader
|
311
|
+
# will handle that.
|
312
|
+
rescue HTTP::TimeoutError
|
313
|
+
# For historical reasons, we rethrow this as our own type
|
314
|
+
raise Errors::ReadTimeoutError.new(@read_timeout)
|
315
|
+
end
|
316
|
+
break if data.nil?
|
317
|
+
gen.yield data
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
event_parser = Impl::EventParser.new(Impl::BufferedLineReader.lines_from(chunks), @last_id)
|
322
|
+
|
321
323
|
event_parser.items.each do |item|
|
322
324
|
return if @stopped.value
|
323
325
|
case item
|
@@ -332,7 +334,7 @@ module SSE
|
|
332
334
|
|
333
335
|
def dispatch_event(event)
|
334
336
|
@logger.debug { "Received event: #{event}" }
|
335
|
-
@last_id = event.id
|
337
|
+
@last_id = event.id if !event.id.nil?
|
336
338
|
|
337
339
|
# Pass the event to the caller
|
338
340
|
@on[:event].call(event)
|
@@ -355,7 +357,7 @@ module SSE
|
|
355
357
|
'Cache-Control' => 'no-cache',
|
356
358
|
'User-Agent' => 'ruby-eventsource'
|
357
359
|
}
|
358
|
-
h['Last-Event-Id'] = @last_id if !@last_id.nil?
|
360
|
+
h['Last-Event-Id'] = @last_id if !@last_id.nil? && @last_id != ""
|
359
361
|
h.merge(@headers)
|
360
362
|
end
|
361
363
|
end
|
@@ -11,6 +11,10 @@ module SSE
|
|
11
11
|
# if there were multiple `data:` lines, they are concatenated with newlines
|
12
12
|
# @!attribute id
|
13
13
|
# @return [String] the string that appeared after `id:` in the stream if any, or nil
|
14
|
+
# @!attribute last_event_id
|
15
|
+
# @return [String] the `id:` value that was most recently seen in an event from
|
16
|
+
# this stream; this differs from the `id` property in that it retains the same value
|
17
|
+
# in subsequent events if they do not provide their own `id:`
|
14
18
|
#
|
15
|
-
StreamEvent = Struct.new(:type, :data, :id)
|
19
|
+
StreamEvent = Struct.new(:type, :data, :id, :last_event_id)
|
16
20
|
end
|
@@ -41,7 +41,11 @@ module SSE
|
|
41
41
|
@last_good_time = nil
|
42
42
|
target = ([@base_interval * (2 ** @attempts), @max_interval].min).to_f
|
43
43
|
@attempts += 1
|
44
|
-
|
44
|
+
if target == 0
|
45
|
+
0 # in some Ruby versions it's illegal to call rand(0)
|
46
|
+
else
|
47
|
+
(target / 2) + @jitter_rand.rand(target / 2)
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
#
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
module SSE
|
3
|
+
module Impl
|
4
|
+
class BufferedLineReader
|
5
|
+
#
|
6
|
+
# Reads a series of data chunks from an enumerator, and returns an enumerator that
|
7
|
+
# parses/aggregates these into text lines. The line terminator may be CR, LF, or
|
8
|
+
# CRLF for each line; terminators are not included in the returned lines. When the
|
9
|
+
# input data runs out, the output enumerator ends and does not include any partially
|
10
|
+
# completed line.
|
11
|
+
#
|
12
|
+
# @param [Enumerator] chunks an enumerator that will yield strings from a stream -
|
13
|
+
# these are treated as raw UTF-8 bytes, regardless of the string's declared encoding
|
14
|
+
# (so it is OK if a multi-byte character is split across chunks); if the declared
|
15
|
+
# encoding of the chunk is not ASCII-8BIT, it will be changed to ASCII-8BIT in place
|
16
|
+
# @return [Enumerator] an enumerator that will yield one line at a time in UTF-8
|
17
|
+
#
|
18
|
+
def self.lines_from(chunks)
|
19
|
+
buffer = "".b
|
20
|
+
position = 0
|
21
|
+
line_start = 0
|
22
|
+
last_char_was_cr = false
|
23
|
+
|
24
|
+
Enumerator.new do |gen|
|
25
|
+
chunks.each do |chunk|
|
26
|
+
chunk.force_encoding("ASCII-8BIT")
|
27
|
+
buffer << chunk
|
28
|
+
|
29
|
+
loop do
|
30
|
+
# Search for a line break in any part of the buffer that we haven't yet seen.
|
31
|
+
i = buffer.index(/[\r\n]/, position)
|
32
|
+
if i.nil?
|
33
|
+
# There isn't a line break yet, so we'll keep accumulating data in the buffer, using
|
34
|
+
# position to keep track of where we left off scanning. We can also discard any previously
|
35
|
+
# parsed lines from the buffer at this point.
|
36
|
+
if line_start > 0
|
37
|
+
buffer.slice!(0, line_start)
|
38
|
+
line_start = 0
|
39
|
+
end
|
40
|
+
position = buffer.length
|
41
|
+
break
|
42
|
+
end
|
43
|
+
|
44
|
+
ch = buffer[i]
|
45
|
+
if i == 0 && ch == "\n" && last_char_was_cr
|
46
|
+
# This is just the dangling LF of a CRLF pair
|
47
|
+
last_char_was_cr = false
|
48
|
+
i += 1
|
49
|
+
position = i
|
50
|
+
line_start = i
|
51
|
+
next
|
52
|
+
end
|
53
|
+
|
54
|
+
line = buffer[line_start, i - line_start].force_encoding("UTF-8")
|
55
|
+
# Calling force_encoding just declares that we believe the encoding of this string to be
|
56
|
+
# UTF-8 (which is the only encoding allowed in the SSE protocol); it doesn't cause any
|
57
|
+
# re-decoding of the string. The previous line-parsing steps were done on raw 8-bit
|
58
|
+
# strings so that it won't try to do any UTF-8 decoding on intermediate slices.
|
59
|
+
|
60
|
+
last_char_was_cr = false
|
61
|
+
i += 1
|
62
|
+
if ch == "\r"
|
63
|
+
if i == buffer.length
|
64
|
+
last_char_was_cr = true # We'll break the line here, but be on watch for a dangling LF
|
65
|
+
elsif buffer[i] == "\n"
|
66
|
+
i += 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if i == buffer.length
|
70
|
+
buffer = ""
|
71
|
+
i = 0
|
72
|
+
end
|
73
|
+
position = i
|
74
|
+
line_start = i
|
75
|
+
gen.yield line
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -20,10 +20,12 @@ module SSE
|
|
20
20
|
#
|
21
21
|
# Constructs an instance of EventParser.
|
22
22
|
#
|
23
|
-
# @param [Enumerator] lines an enumerator that will yield one line of text at a time
|
23
|
+
# @param [Enumerator] lines an enumerator that will yield one line of text at a time;
|
24
|
+
# the lines should not include line terminators
|
24
25
|
#
|
25
|
-
def initialize(lines)
|
26
|
+
def initialize(lines, last_event_id = nil)
|
26
27
|
@lines = lines
|
28
|
+
@last_event_id = last_event_id
|
27
29
|
reset_buffers
|
28
30
|
end
|
29
31
|
|
@@ -31,7 +33,6 @@ module SSE
|
|
31
33
|
def items
|
32
34
|
Enumerator.new do |gen|
|
33
35
|
@lines.each do |line|
|
34
|
-
line.chomp!
|
35
36
|
if line.empty?
|
36
37
|
event = maybe_create_event
|
37
38
|
reset_buffers
|
@@ -53,6 +54,7 @@ module SSE
|
|
53
54
|
@id = nil
|
54
55
|
@type = nil
|
55
56
|
@data = ""
|
57
|
+
@have_data = false
|
56
58
|
end
|
57
59
|
|
58
60
|
def process_field(name, value)
|
@@ -60,10 +62,14 @@ module SSE
|
|
60
62
|
when "event"
|
61
63
|
@type = value.to_sym
|
62
64
|
when "data"
|
63
|
-
@data << "\n" if
|
65
|
+
@data << "\n" if @have_data
|
64
66
|
@data << value
|
67
|
+
@have_data = true
|
65
68
|
when "id"
|
66
|
-
|
69
|
+
if !value.include?("\x00")
|
70
|
+
@id = value
|
71
|
+
@last_event_id = value
|
72
|
+
end
|
67
73
|
when "retry"
|
68
74
|
if /^(?<num>\d+)$/ =~ value
|
69
75
|
return SetRetryInterval.new(num.to_i)
|
@@ -73,8 +79,8 @@ module SSE
|
|
73
79
|
end
|
74
80
|
|
75
81
|
def maybe_create_event
|
76
|
-
return nil if
|
77
|
-
StreamEvent.new(@type || :message, @data, @id)
|
82
|
+
return nil if !@have_data
|
83
|
+
StreamEvent.new(@type || :message, @data, @id, @last_event_id)
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld-eventsource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.10
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,22 @@ dependencies:
|
|
84
84
|
name: http
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 4.4.1
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 6.0.0
|
90
93
|
type: :runtime
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
|
-
- - "
|
97
|
+
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
99
|
version: 4.4.1
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 6.0.0
|
97
103
|
description: LaunchDarkly SSE client for Ruby
|
98
104
|
email:
|
99
105
|
- team@launchdarkly.com
|
@@ -101,28 +107,16 @@ executables: []
|
|
101
107
|
extensions: []
|
102
108
|
extra_rdoc_files: []
|
103
109
|
files:
|
104
|
-
- ".circleci/config.yml"
|
105
|
-
- ".gitignore"
|
106
|
-
- ".ldrelease/config.yml"
|
107
|
-
- CHANGELOG.md
|
108
|
-
- Gemfile
|
109
|
-
- Gemfile.lock
|
110
110
|
- LICENSE
|
111
111
|
- README.md
|
112
|
-
- ld-eventsource.gemspec
|
113
112
|
- lib/ld-eventsource.rb
|
114
113
|
- lib/ld-eventsource/client.rb
|
115
114
|
- lib/ld-eventsource/errors.rb
|
116
115
|
- lib/ld-eventsource/events.rb
|
117
116
|
- lib/ld-eventsource/impl/backoff.rb
|
117
|
+
- lib/ld-eventsource/impl/buffered_line_reader.rb
|
118
118
|
- lib/ld-eventsource/impl/event_parser.rb
|
119
119
|
- lib/ld-eventsource/version.rb
|
120
|
-
- scripts/gendocs.sh
|
121
|
-
- scripts/release.sh
|
122
|
-
- spec/backoff_spec.rb
|
123
|
-
- spec/client_spec.rb
|
124
|
-
- spec/event_parser_spec.rb
|
125
|
-
- spec/http_stub.rb
|
126
120
|
homepage: https://github.com/launchdarkly/ruby-eventsource
|
127
121
|
licenses:
|
128
122
|
- Apache-2.0
|
@@ -142,13 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
136
|
- !ruby/object:Gem::Version
|
143
137
|
version: '0'
|
144
138
|
requirements: []
|
145
|
-
|
146
|
-
rubygems_version: 2.5.2.3
|
139
|
+
rubygems_version: 3.3.4
|
147
140
|
signing_key:
|
148
141
|
specification_version: 4
|
149
142
|
summary: LaunchDarkly SSE client
|
150
|
-
test_files:
|
151
|
-
- spec/backoff_spec.rb
|
152
|
-
- spec/client_spec.rb
|
153
|
-
- spec/event_parser_spec.rb
|
154
|
-
- spec/http_stub.rb
|
143
|
+
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
workflows:
|
4
|
-
version: 2
|
5
|
-
test:
|
6
|
-
jobs:
|
7
|
-
- test-2.5
|
8
|
-
- test-2.6
|
9
|
-
- test-2.7
|
10
|
-
- test-3.0
|
11
|
-
- test-jruby-9.2
|
12
|
-
|
13
|
-
ruby-docker-template: &ruby-docker-template
|
14
|
-
steps:
|
15
|
-
- checkout
|
16
|
-
- run: |
|
17
|
-
if [[ $CIRCLE_JOB == test-jruby* ]]; then
|
18
|
-
gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
|
19
|
-
fi
|
20
|
-
- run: sudo apt-get update -y && sudo apt-get install -y build-essential
|
21
|
-
- run: ruby -v
|
22
|
-
- run: gem install bundler -v "~> 1.17"
|
23
|
-
- run: bundle install
|
24
|
-
- run: mkdir ./rspec
|
25
|
-
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o ./rspec/rspec.xml spec
|
26
|
-
- store_test_results:
|
27
|
-
path: ./rspec
|
28
|
-
- store_artifacts:
|
29
|
-
path: ./rspec
|
30
|
-
|
31
|
-
jobs:
|
32
|
-
test-2.5:
|
33
|
-
<<: *ruby-docker-template
|
34
|
-
docker:
|
35
|
-
- image: circleci/ruby:2.5
|
36
|
-
test-2.6:
|
37
|
-
<<: *ruby-docker-template
|
38
|
-
docker:
|
39
|
-
- image: circleci/ruby:2.6
|
40
|
-
test-2.7:
|
41
|
-
<<: *ruby-docker-template
|
42
|
-
docker:
|
43
|
-
- image: circleci/ruby:2.7
|
44
|
-
test-3.0:
|
45
|
-
<<: *ruby-docker-template
|
46
|
-
docker:
|
47
|
-
- image: circleci/ruby:3.0
|
48
|
-
test-jruby-9.2:
|
49
|
-
<<: *ruby-docker-template
|
50
|
-
docker:
|
51
|
-
- image: circleci/jruby:9.2-jdk
|
data/.gitignore
DELETED
data/.ldrelease/config.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
repo:
|
2
|
-
public: ruby-eventsource
|
3
|
-
|
4
|
-
publications:
|
5
|
-
- url: https://rubygems.org/gems/ld-eventsource
|
6
|
-
description: RubyGems
|
7
|
-
- url: https://www.rubydoc.info/gems/ld-eventsource
|
8
|
-
description: documentation
|
9
|
-
|
10
|
-
releasableBranches:
|
11
|
-
- name: master
|
12
|
-
description: 2.x - based on the http gem
|
13
|
-
- name: 1.x
|
14
|
-
description: 1.x - based on the socketry gem
|
15
|
-
|
16
|
-
template:
|
17
|
-
name: ruby
|
data/CHANGELOG.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Change log
|
2
|
-
|
3
|
-
All notable changes to the LaunchDarkly SSE Client for Ruby will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
|
4
|
-
|
5
|
-
## [1.0.3] - 2020-03-17
|
6
|
-
### Fixed:
|
7
|
-
- The backoff delay logic for reconnecting after a stream failure was broken so that if a failure occurred after a stream had been active for at least `reconnect_reset_interval` (default 60 seconds), retries would use _no_ delay, potentially causing a flood of requests and a spike in CPU usage.
|
8
|
-
|
9
|
-
## [1.0.2] - 2020-03-10
|
10
|
-
### Removed:
|
11
|
-
- Removed an unused dependency on `rake`. There are no other changes in this release.
|
12
|
-
|
13
|
-
|
14
|
-
## [1.0.1] - 2019-07-10
|
15
|
-
### Fixed:
|
16
|
-
- Calling `close` on the client could cause a misleading warning message in the log, such as `Unexpected error from event source: #<IOError: stream closed in another thread>`.
|
17
|
-
|
18
|
-
## [1.0.0] - 2019-01-03
|
19
|
-
|
20
|
-
Initial release.
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ld-eventsource (2.0.0)
|
5
|
-
concurrent-ruby (~> 1.0)
|
6
|
-
http (~> 4.4.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.7.0)
|
12
|
-
public_suffix (>= 2.0.2, < 5.0)
|
13
|
-
concurrent-ruby (1.1.8)
|
14
|
-
diff-lcs (1.3)
|
15
|
-
domain_name (0.5.20190701)
|
16
|
-
unf (>= 0.0.5, < 1.0.0)
|
17
|
-
ffi (1.14.2)
|
18
|
-
ffi (1.14.2-java)
|
19
|
-
ffi-compiler (1.0.1)
|
20
|
-
ffi (>= 1.0.0)
|
21
|
-
rake
|
22
|
-
http (4.4.1)
|
23
|
-
addressable (~> 2.3)
|
24
|
-
http-cookie (~> 1.0)
|
25
|
-
http-form_data (~> 2.2)
|
26
|
-
http-parser (~> 1.2.0)
|
27
|
-
http-cookie (1.0.3)
|
28
|
-
domain_name (~> 0.5)
|
29
|
-
http-form_data (2.3.0)
|
30
|
-
http-parser (1.2.3)
|
31
|
-
ffi-compiler (>= 1.0, < 2.0)
|
32
|
-
public_suffix (4.0.6)
|
33
|
-
rake (13.0.3)
|
34
|
-
rspec (3.7.0)
|
35
|
-
rspec-core (~> 3.7.0)
|
36
|
-
rspec-expectations (~> 3.7.0)
|
37
|
-
rspec-mocks (~> 3.7.0)
|
38
|
-
rspec-core (3.7.1)
|
39
|
-
rspec-support (~> 3.7.0)
|
40
|
-
rspec-expectations (3.7.0)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.7.0)
|
43
|
-
rspec-mocks (3.7.0)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.7.0)
|
46
|
-
rspec-support (3.7.0)
|
47
|
-
rspec_junit_formatter (0.3.0)
|
48
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
49
|
-
unf (0.1.4)
|
50
|
-
unf_ext
|
51
|
-
unf (0.1.4-java)
|
52
|
-
unf_ext (0.0.7.7)
|
53
|
-
webrick (1.7.0)
|
54
|
-
|
55
|
-
PLATFORMS
|
56
|
-
java
|
57
|
-
ruby
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
bundler (~> 1.7)
|
61
|
-
ld-eventsource!
|
62
|
-
rspec (~> 3.2)
|
63
|
-
rspec_junit_formatter (~> 0.3.0)
|
64
|
-
webrick (~> 1.7)
|
65
|
-
|
66
|
-
BUNDLED WITH
|
67
|
-
1.17.3
|
data/ld-eventsource.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "ld-eventsource/version"
|
6
|
-
|
7
|
-
# rubocop:disable Metrics/BlockLength
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = "ld-eventsource"
|
10
|
-
spec.version = SSE::VERSION
|
11
|
-
spec.authors = ["LaunchDarkly"]
|
12
|
-
spec.email = ["team@launchdarkly.com"]
|
13
|
-
spec.summary = "LaunchDarkly SSE client"
|
14
|
-
spec.description = "LaunchDarkly SSE client for Ruby"
|
15
|
-
spec.homepage = "https://github.com/launchdarkly/ruby-eventsource"
|
16
|
-
spec.license = "Apache-2.0"
|
17
|
-
|
18
|
-
spec.files = `git ls-files -z`.split("\x0")
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.2"
|
25
|
-
spec.add_development_dependency "rspec_junit_formatter", "~> 0.3.0"
|
26
|
-
spec.add_development_dependency "webrick", "~> 1.7"
|
27
|
-
|
28
|
-
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
29
|
-
spec.add_runtime_dependency "http", "~> 4.4.1"
|
30
|
-
end
|
data/scripts/gendocs.sh
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Use this script to generate documentation locally in ./doc so it can be proofed before release.
|
4
|
-
# After release, documentation will be visible at https://www.rubydoc.info/gems/ld-eventsource
|
5
|
-
|
6
|
-
gem install --conservative yard
|
7
|
-
gem install --conservative redcarpet # provides Markdown formatting
|
8
|
-
|
9
|
-
# yard doesn't seem to do recursive directories, even though Ruby's Dir.glob supposedly recurses for "**"
|
10
|
-
PATHS="lib/*.rb lib/**/*.rb lib/**/**/*.rb"
|
11
|
-
|
12
|
-
yard doc --no-private --markup markdown --markup-provider redcarpet --embed-mixins $PATHS - README.md
|