I use http and access to fluentd server.
The procession is here.
def input_fluentd(body)
HTTP.timeout(write: 1, connect: 1, read: 1).post("#{ENV['FLUENTD_ENDPOINT_HTTP']}/user_action", json: body)
end
However, I get errors like below sometimes.
There are not a lot of accesses and the max of query per second is about 20.
What should I do?
```
*A* `HTTP::TimeoutError` *occured in background*
Exception
----------------
execution expired
Hostname
----------------
24b9d913-0d52-4f58-b391-c504acab50fa
Backtrace
----------------
```/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:25:in `initialize'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:25:in `open'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:25:in `block in connect'
/app/vendor/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:24:in `connect'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/connection.rb:41:in `initialize'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/client.rb:60:in `new'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/client.rb:60:in `perform'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/client.rb:41:in `request'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/chainable.rb:26:in `post'
/app/app/controllers/application_controller.rb:100:in `input_fluentd'
/app/app/controllers/application_controller.rb:93:in `logging_handler'
/app/app/controllers/tracking_events_controller.rb:8:in `log_tracking'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/abstract_controller/base.rb:188:in `process_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/action_controller/metal/rendering.rb:30:in `process_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:126:in `call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:455:in `call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:101:…
```
and
```
*A* `HTTP::TimeoutError` *occured in background*
Exception
----------------
Read timed out after 1 seconds
Hostname
----------------
5b386525-7f19-4e9a-91ed-2da627a1d14a
Backtrace
----------------
```/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:69:in `block in readpartial'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:62:in `loop'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/timeout/per_operation.rb:62:in `readpartial'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/connection.rb:212:in `read_more'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/connection.rb:99:in `block in read_headers!'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/connection.rb:98:in `loop'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/connection.rb:98:in `read_headers!'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/client.rb:64:in `perform'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/client.rb:41:in `request'
/app/vendor/bundle/ruby/2.3.0/gems/http-2.1.0/lib/http/chainable.rb:26:in `post'
/app/app/controllers/application_controller.rb:100:in `input_fluentd'
/app/app/controllers/application_controller.rb:93:in `logging_handler'
/app/app/controllers/tracking_events_controller.rb:8:in `log_tracking'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/abstract_controller/base.rb:188:in `process_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/action_controller/metal/rendering.rb:30:in `process_action'
/app/vendor/bundle/ruby/2.3.0/gems/actionpack-5.0.1.rc2/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:126:in `call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.rc2/lib/active_support/callbacks.rb:455:in `call'
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1.r…
```