mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 01:02:34 +00:00
Replaced most Excon + Thread calls with Async
This commit is contained in:
10
lib/cache.rb
10
lib/cache.rb
@@ -7,18 +7,16 @@ class W3DHub
|
||||
end
|
||||
|
||||
# Fetch a generic uri
|
||||
def self.fetch(uri)
|
||||
def self.fetch(internet, uri)
|
||||
path = path(uri)
|
||||
|
||||
if File.exist?(path)
|
||||
path
|
||||
else
|
||||
response = Excon.get(uri, tcp_nodelay: true)
|
||||
response = internet.get(uri, [["user-agent", W3DHub::Api::USER_AGENT]])
|
||||
|
||||
if response.status == 200
|
||||
File.open(path, "wb") do |f|
|
||||
f.write(response.body)
|
||||
end
|
||||
if response.success?#status == 200
|
||||
response.save(path)
|
||||
|
||||
path
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user