Refactor client creation

This commit is contained in:
Omar Roth
2018-02-05 19:07:49 -06:00
parent 0e704056a1
commit 990bca5af5
2 changed files with 10 additions and 12 deletions

View File

@@ -209,3 +209,10 @@ def rank_videos(db, n)
# Return top
return top[1..n]
end
def make_client(url, context)
client = HTTP::Client.new(URL, CONTEXT)
client.read_timeout = 10.seconds
client.connect_timeout = 10.seconds
return client
end