Skip to content

Commit 04bda83

Browse files
refactor: close if data.nil
1 parent 73cd595 commit 04bda83

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/ld-eventsource/client.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ def initialize(uri,
119119
@uri = URI(uri)
120120
@stopped = Concurrent::AtomicBoolean.new(false)
121121
@retry_enabled = retry_enabled
122-
@eof = false
123122

124123
@headers = headers.clone
125124
@connect_timeout = connect_timeout
@@ -266,7 +265,6 @@ def run_stream
266265
# connected but before @cxn was set. Checking the variable again is a bit clunky but avoids that.
267266
return if @stopped.value
268267
read_stream(resp) unless resp.nil?
269-
return close if @eof
270268
rescue => e
271269
# When we deliberately close the connection, it will usually trigger an exception. The exact type
272270
# of exception depends on the specific Ruby runtime. But @stopped will always be set in this case.
@@ -348,7 +346,7 @@ def read_stream(cxn)
348346
end
349347

350348
if data.nil?
351-
@eof = true
349+
close
352350
break
353351
end
354352

0 commit comments

Comments
 (0)