我在 Ruby 中使用 Mandrill-api 以编程方式发送交易电子邮件。
我的rails应用程序中有(或多或少)以下行,
mandrill ||= Mandrill::API.new const(:API)[:MANDRILL_APIKEY]
... (constructing the message, content, etc)
mandrill.messages.send_template templ, template_content, message, true
问题是在生产中运行时,它偶尔会返回以下错误。
Excon::Errors::SocketError (EOFError (EOFError)):
app/mailers/mailer.rb:24:in `send'
....
我不知道如何调试这个问题。如果有人能告诉我调试这个的方法,我非常感激。
宝石信息:
- 山魈 API (1.0.33)
- excon (0.16.10)
生产环境:
sudo bundle exec rake RAILS_ENV=production about
About your application's environment
Ruby version 1.9.3 (x86_64-linux)
RubyGems version 1.8.11
Rack version 1.4
Rails version 3.2.13
Active Record version 3.2.13
Action Pack version 3.2.13
Active Resource version 3.2.13
Action Mailer version 3.2.13
Active Support version 3.2.13
Middleware Rack::Cache, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000001e72330>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport
Environment production
Database adapter mysql2
运行:
Apache 服务器:Apache/2.2.22 (Ubuntu)
乘客:3.0.14