File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ class Client
5252 # The default HTTP method for requests.
5353 DEFAULT_HTTP_METHOD = "GET"
5454
55+ THREAD_NAME = 'LD/SSEClient'
56+
5557 #
5658 # Creates a new SSE client.
5759 #
@@ -112,7 +114,8 @@ def initialize(uri,
112114 method : DEFAULT_HTTP_METHOD ,
113115 payload : nil ,
114116 retry_enabled : true ,
115- http_client_options : nil )
117+ http_client_options : nil ,
118+ async : true )
116119 @uri = URI ( uri )
117120 @stopped = Concurrent ::AtomicBoolean . new ( false )
118121 @retry_enabled = retry_enabled
@@ -167,7 +170,11 @@ def initialize(uri,
167170
168171 yield self if block_given?
169172
170- Thread . new { run_stream } . name = 'LD/SSEClient'
173+ if async
174+ Thread . new { run_stream } . name = THREAD_NAME
175+ else
176+ run_stream
177+ end
171178 end
172179
173180 #
You can’t perform that action at this time.
0 commit comments