我遇到了一个问题,mix test在CircleCI上偶尔失败,有以下错误:
16:46:05.935错误Postgrex.Protocol (#PID<0.9303.0>)断开:** (DBConnection.ConnectionError)所有者#PID<0.73.0>超时,因为它拥有超过15000 it的连接
我尝试将测试配置中的超时值增加到以下内容:
config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
database: System.get_env("DB_NAME"),
username: System.get_env("DB_USER"),
password: System.get_env("DB_PASS"),
hostname: System.get_env("DB_HOST"),
pool: Ecto.Adapters.SQL.Sandbox,
timeout: 30000但在15000毫秒之后,它仍在计时。我还需要找另一种环境吗?
发布于 2017-05-10 21:16:23
您需要在这里增加ownership_timeout,而不是timeout。这在Ecto.Adapters.SQL.Sandbox的模块文档( owner timed out because it owned the connection for longer than Nms )中有记录。
如果您有一个长时间运行的测试(或者您正在使用
IEx.pry进行调试),那么连接所有权的超时时间可能太短。您可以通过在:ownership_timeout(最好是在config/test.exs中)中为回购配置设置config/config.exs选项来增加超时:
https://stackoverflow.com/questions/43902735
复制相似问题