petems / tugboat

A command line tool for interacting with your DigitalOcean droplets.
MIT License
1.45k stars 89 forks source link

Add configurable timeout to config file #283

Closed petems closed 6 years ago

petems commented 6 years ago
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling c0368dfd50abc3fd5e8add2cdb1089e8d69577af on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling c0368dfd50abc3fd5e8add2cdb1089e8d69577af on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

petems commented 6 years ago

@lachesis can you try running on this branch after setting the timeout higher and seeing if it works for you?

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling 88b14b1dff39dbcc4e5a65beba54a2fc81f40697 on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

lachesis commented 6 years ago

It seems to have worked for me on my second try (with a timeout of 15 minutes :P). I tried 90 seconds but I got distracted and when I came back it had this stack trace:

/usr/lib/ruby/2.4.0/net/protocol.rb:176:in `rbuf_fill': Net::ReadTimeout (Faraday::TimeoutError)
    from /usr/lib/ruby/2.4.0/net/protocol.rb:154:in `readuntil'
    from /usr/lib/ruby/2.4.0/net/protocol.rb:164:in `readline'
    from /usr/lib/ruby/2.4.0/net/http/response.rb:40:in `read_status_line'
    from /usr/lib/ruby/2.4.0/net/http/response.rb:29:in `read_new'
    from /usr/lib/ruby/2.4.0/net/http.rb:1446:in `block in transport_request'
    from /usr/lib/ruby/2.4.0/net/http.rb:1443:in `catch'
    from /usr/lib/ruby/2.4.0/net/http.rb:1443:in `transport_request'
    from /usr/lib/ruby/2.4.0/net/http.rb:1416:in `request'
    from /usr/lib/ruby/2.4.0/net/http.rb:1409:in `block in request'
    from /usr/lib/ruby/2.4.0/net/http.rb:877:in `start'
    from /usr/lib/ruby/2.4.0/net/http.rb:1407:in `request'
    from /usr/lib/ruby/2.4.0/net/http.rb:1165:in `get'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:80:in `perform_request'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
    from /home/eswanson/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
    from /home/eswanson/.gem/ruby/2.3.0/gems/barge-0.12.0/lib/barge/resource/base.rb:22:in `public_send'
    from /home/eswanson/.gem/ruby/2.3.0/gems/barge-0.12.0/lib/barge/resource/base.rb:22:in `request'
    from /home/eswanson/.gem/ruby/2.3.0/gems/barge-0.12.0/lib/barge/resource/base.rb:16:in `block (2 levels) in <module:Base>'
    from /home/eswanson/.gem/ruby/2.3.0/gems/barge-0.12.0/lib/barge/resource/droplet.rb:11:in `all'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/base.rb:92:in `block (2 levels) in get_droplet_list'
    from /home/eswanson/.gem/ruby/2.4.0/gems/activesupport-4.2.9/lib/active_support/core_ext/range/each.rb:7:in `each'
    from /home/eswanson/.gem/ruby/2.4.0/gems/activesupport-4.2.9/lib/active_support/core_ext/range/each.rb:7:in `each_with_time_with_zone'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/base.rb:91:in `block in get_droplet_list'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/list_droplets.rb:13:in `each'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/list_droplets.rb:13:in `each'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/list_droplets.rb:13:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/inject_client.rb:29:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/check_configuration.rb:17:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/middleware/inject_configuration.rb:10:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/ibsciss-middleware-0.4.2/lib/middleware/runner.rb:31:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/ibsciss-middleware-0.4.2/lib/middleware/builder.rb:133:in `call'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/lib/tugboat/cli.rb:71:in `droplets'
    from /home/eswanson/.gem/ruby/2.3.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /home/eswanson/.gem/ruby/2.3.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /home/eswanson/.gem/ruby/2.3.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /home/eswanson/.gem/ruby/2.3.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /home/eswanson/.gem/ruby/2.4.0/gems/tugboat-3.1.0/bin/tugboat:10:in `<top (required)>'
    from /home/eswanson/.gem/ruby/2.1.0/bin/tugboat:23:in `load'
    from /home/eswanson/.gem/ruby/2.1.0/bin/tugboat:23:in `<main>'

Since I didn't see how long it took to fail like that, I'm not 100% sure that the 15 minute timeout is what made it work and not just caching on DigitalOcean's side. Even with the 10 second timeout, I could get it to load after a few retries.

Here is what I added to my config file:

connection:
  timeout: 900
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling a3cac233f282d4f2253b0f733ab60fe475d18444 on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling 45eef9a3653dd0fee493c8a5f08e3c9bb8bfa4db on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling 45eef9a3653dd0fee493c8a5f08e3c9bb8bfa4db on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling 45eef9a3653dd0fee493c8a5f08e3c9bb8bfa4db on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 98.025% when pulling 45eef9a3653dd0fee493c8a5f08e3c9bb8bfa4db on add_timeout_lachesis into bc58bed3acf088b9c273687d75848d0dfe9b2251 on master.

petems commented 6 years ago

I'm going to merge this anyways, as it's a nice change to have, but I've got an idea to fix your issue.