Removed Async[websocket/http] due to excessive require times and reliablity issues on Windows

This commit is contained in:
2022-10-30 18:10:47 -05:00
parent 7359d73027
commit 340c083a43
12 changed files with 176 additions and 210 deletions

View File

@@ -16,12 +16,12 @@ class W3DHub
path
elsif async
BackgroundWorker.job(
-> { Async::HTTP::Internet.instance.get(uri, W3DHub::Api::DEFAULT_HEADERS) },
->(response) { response.save(path, "wb") if response.success? }
-> { Api.get(uri, W3DHub::Api::DEFAULT_HEADERS) },
->(response) { File.open(path, "wb") { |f| f.write response.body } if response.status == 200 }
)
else
response = Async::HTTP::Internet.instance.get(uri, W3DHub::Api::DEFAULT_HEADERS)
response.save(path, "wb") if response.success?
response = Api.get(uri, W3DHub::Api::DEFAULT_HEADERS)
File.open(path, "wb") { |f| f.write response.body } if response.status == 200
end
end
@@ -82,7 +82,7 @@ class W3DHub
block.call(chunk, remaining_bytes, total_bytes)
end
response.success?
response.status == 200
ensure
file&.close
end