kylejginavan / youtube_it

An object-oriented Ruby wrapper for the YouTube GData API
http://groups.google.com/group/ruby-youtube-library
595 stars 223 forks source link

Add timeout values to initialiser? #162

Closed 45sound closed 11 years ago

45sound commented 11 years ago

Is it possible to alter the read and write timeouts that the underlying Faraday library calling Net::HTTP uses? Currently it is set to 60 seconds, but when uploading a large 500MB file to youtube via video_upload on a slow connection, I get the following error below. Code works fine on an identical server with a higher bandwidth connection.

youtube_client.video_upload(File.open(video_path), :title => "TITLE", :description => "TEST:, :category => "Sports", :keywords => ["sample", "words"], :embed => "allowed", :list => "allowed"t)

Broken pipe /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/protocol.rb:199:in write' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/protocol.rb:199:inwrite0' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/protocol.rb:173:in block in write' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/protocol.rb:190:inwriting' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/protocol.rb:172:in write' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1955:insend_request_with_body_stream' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1921:in exec' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1317:inblock in transport_request' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1316:in catch' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1316:intransport_request' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1293:in request' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/patches/net_patches.rb:7:inblock in request_with_mini_profiler' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/mini_profiler/profiling_methods.rb:40:in step' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/patches/net_patches.rb:6:inrequest_with_mini_profiler' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/net.rb:22:in block in request_with_newrelic_trace' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:240:intrace_execution_scoped' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/net.rb:21:in request_with_newrelic_trace' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1286:inblock in request' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:745:in start' /home/vinny/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:1284:inrequest' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/patches/net_patches.rb:7:in block in request_with_mini_profiler' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/mini_profiler/profiling_methods.rb:40:instep' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/rack-mini-profiler-0.1.25/Ruby/lib/patches/net_patches.rb:6:in request_with_mini_profiler' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/net.rb:22:inblock in request_with_newrelic_trace' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:240:in trace_execution_scoped' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/net.rb:21:inrequest_with_newrelic_trace' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:75:in perform_request' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:38:incall' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.8.7/lib/faraday/response.rb:8:in call' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/youtube_it-2.1.13/lib/youtube_it/middleware/faraday_authheader.rb:17:incall' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in run_request' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/faraday-0.8.7/lib/faraday/connection.rb:112:inpost' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/youtube_it-2.1.13/lib/youtube_it/request/video_upload.rb:92:in upload' /home/vinny/.rvm/gems/ruby-1.9.3-p374/gems/youtube_it-2.1.13/lib/youtube_it/client.rb:106:invideo_upload'

chebyte commented 11 years ago

mm I think that the problem is cause you are loosing packages, by the way you are not getting TIME OUT ERROR you are getting Broken pipe, so I think that your server kill the connection or something like this

vinnyglennon commented 11 years ago

Thanks very much for the reply! :) V