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
Keep caches alive in case of postgres unavailability (#4974)
hq15427a7aee30e
diff --git a/lib/plausible/cache.ex b/lib/plausible/cache.exindex 2ffe2f2886..75f8766a1a 100644--- a/lib/plausible/cache.ex+++ b/lib/plausible/cache.ex@@ -62,6 +62,7 @@ defmodule Plausible.Cache do@modes [:all, :updated_recently]alias Plausible.Cache.Adapter+ require Logger@spec get(any(), Keyword.t()) :: any() | nildef get(key, opts \\ []) when is_list(opts) do@@ -182,8 +183,13 @@ defmodule Plausible.Cache doPlausible.PromEx.Plugins.PlausibleMetrics.measure_duration(telemetry_event_refresh(cache_name, mode),fn ->- items = repo().all(query)- :ok = merge_items(items, opts)+ try do+ items = repo().all(query)+ :ok = merge_items(items, opts)+ catch+ _, e ->+ Logger.error("Error refreshing '#{cache_name}' - #{inspect(e)}")+ endend)