Skip to content

don't use continue in Stats init for test env

Alexander Strizhakov requested to merge fix/repo-terminate into develop

Doesn't fully fix Pleroma.Repo termination in tests, but significantly reduces the number of them.

Most often before Pleroma.Repo termination appear error message:

[error] GenServer Pleroma.Stats terminating
** (DBConnection.ConnectionError) tcp recv: closed (the connection was closed by the pool, possibly due to a timeout or because the pool has been terminated)
    (ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:593: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:526: Ecto.Adapters.SQL.execute/5
    (ecto 3.4.6) lib/ecto/repo/queryable.ex:192: Ecto.Repo.Queryable.execute/4
    (ecto 3.4.6) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
    (pleroma 2.2.50-1020-g279fe969-feature-2515-admin-statuses+test) lib/pleroma/stats.ex:69: Pleroma.Stats.calculate_stat_data/0
    (pleroma 2.2.50-1020-g279fe969-feature-2515-admin-statuses+test) lib/pleroma/stats.ex:107: Pleroma.Stats.handle_continue/2
    (stdlib 3.14) gen_server.erl:689: :gen_server.try_dispatch/4
    (stdlib 3.14) gen_server.erl:431: :gen_server.loop/7
Last message: {:continue, :calculate_stats}
State: nil

and after this message, tests start to fail with

** (RuntimeError) could not lookup Ecto repo Pleroma.Repo because it was not started or it does not exist

Merge request reports