在Heroku Cedar上使用Postgres,当我尝试使用OpenSSL验证公钥时,与数据库的连接将丢失。
# Recreate the error using a Base64 encoded key (BASE64_KEY below) you can go into the console and do the following:
decoded_key = Base64.decode64(BASE64_KEY)
public_key = OpenSSL::PKey::RSA.new(decoded_key)
public_key.verify(OpenSSL::Digest::SHA1.new, "", "")
# Database connection is lost when this fails.
当验证通过时,一切都是笨拙的。我似乎无法在开发中复制这种行为。
关于它为什么会发生的任何想法?更好的是,是否有解决方法?
答案 0 :(得分:0)
对于落后于此的人,我最终通过线程验证验证过程并读出线程的结果。这样主线程的数据库连接就不会丢失。
很难理想,但它有效!
答案 1 :(得分:0)
使用以下代码执行SSL代码后重新连接Heroku数据库:https://devcenter.heroku.com/articles/concurrency-and-database-connections