Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Make `ClickhouseRepo` task timeouts configurable in CE (#4494)
ruslandoga9ba9e2abc5a0
diff --git a/lib/plausible/clickhouse_repo.ex b/lib/plausible/clickhouse_repo.exindex 35821d8d46..a6b29ee3ef 100644--- a/lib/plausible/clickhouse_repo.ex+++ b/lib/plausible/clickhouse_repo.ex@@ -1,4 +1,6 @@defmodule Plausible.ClickhouseRepo do+ use Plausible+use Ecto.Repo,otp_app: :plausible,adapter: Ecto.Adapters.ClickHouse,@@ -23,9 +25,19 @@ defmodule Plausible.ClickhouseRepo domax_concurrency = Keyword.get(opts, :max_concurrency, 3)+ task_timeout =+ on_ee do+ @task_timeout+ else+ # Quadruple the repo timeout to ensure the task doesn't timeout before db_connection does.+ # This maintains the default ratio (@task_timeout / default_timeout = 60_000 / 15_000 = 4).+ ch_timeout = Keyword.fetch!(config(), :timeout)+ max(ch_timeout * 4, @task_timeout)+ end+Task.async_stream(queries, execute_with_tracing,max_concurrency: max_concurrency,- timeout: @task_timeout+ timeout: task_timeout)|> Enum.to_list()|> Keyword.values()