Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure apps started #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tmartin8080
Copy link

@tmartin8080 tmartin8080 commented Dec 22, 2022

Issue

Erlang: 25.2
Elixir: 1.14.2
Phoenix: 1.7.0-rc.0

Using ecto_sql 3.9.2 and plausible versions of clickhousex / clickhouse_ecto on a fresh phoenix 1.7 app

mix ecto.create would throw an error:

** (Mix) The database for Data.Repo couldn't be created: exited in: GenServer.call(DBConnection.Watcher, {:watch, DBConnection.ConnectionPool.Supervisor, {DBConnection.ConnectionPool.Pool, {#PID<0.354.0>, #Reference<0.2612184000.274071554.55291>, Clickhousex.Protocol, [backoff_type: :stop, database: nil, telemetry_prefix: [:data, :repo], otp_app: :data, timeout: 15000, adapter: ClickhouseEcto, scheme: :http, hostname: "localhost", port: 8123, username: "admin", password: "password", queue_target: 500, queue_interval: 2000, flush_interval_ms: 5000, max_buffer_size: 10000, show_sensitive_data_on_connection_error: true]}}}, :infinity)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started

Changes

Looking through ecto_sql, noticed that it's ensuring the deps are started

Added these to the top of run_query/2 and now the mix tasks are working as expected.

Concerns

Not entirely sure what the impact might be on existing apps but Application.ensure_all_started/2 seems idempotent and safe to call if the deps are started elsewhere.

fermuch pushed a commit to fermuch/clickhouse_ecto that referenced this pull request May 25, 2023
Allow to create/drop DB on cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant