Skip to content

Commit c235b5d

Browse files
committed
refactor(lib): Remove unused code in websocket_listener & iam_token_manager
1 parent 864a81b commit c235b5d

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

lib/ibm_watson/iam_token_manager.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ def request(method:, url:, headers: nil, params: nil, data: nil)
4343
headers: headers,
4444
params: params
4545
)
46-
else
47-
data = data.to_json if data.respond_to?(:to_json)
48-
response = HTTP.request(
49-
method,
50-
url,
51-
headers: headers,
52-
body: data,
53-
params: params
54-
)
5546
end
5647
return JSON.parse(response.body.to_s) if (200..299).cover?(response.code)
5748
require_relative("./watson_api_exception.rb")

lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def start
7272
end
7373

7474
on_error = lambda do |event|
75-
p event.message
75+
@callback.on_error(error: event)
7676
end
7777

7878
EM&.reactor_thread&.join
@@ -127,12 +127,9 @@ def send_audio(data:)
127127
end
128128
else
129129
if @bytes_sent + ONE_KB >= @data_size
130-
if @data_size > @bytes_sent
131-
send_chunk(chunk: data.read(ONE_KB), final: true)
132-
@timer.cancel if @timer.respond_to?(:cancel)
133-
return
134-
end
130+
send_chunk(chunk: data.read(ONE_KB), final: true)
135131
@timer.cancel if @timer.respond_to?(:cancel)
132+
return
136133
end
137134
send_chunk(chunk: data.read(ONE_KB), final: false)
138135
end

0 commit comments

Comments
 (0)