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
Retry persistor requests on HTTP2 disconnected errors (#5695)
Adrian Gruntkowskiaa803e7e45f9
diff --git a/lib/plausible/ingestion/persistor/remote.ex b/lib/plausible/ingestion/persistor/remote.exindex d0b96ebe8c..62fd3dd100 100644--- a/lib/plausible/ingestion/persistor/remote.ex+++ b/lib/plausible/ingestion/persistor/remote.ex@@ -5,6 +5,8 @@ defmodule Plausible.Ingestion.Persistor.Remote dorequire Logger+ @max_transient_retries 3+def persist_event(ingest_event, previous_user_id, opts) doevent = ingest_event.clickhouse_eventsession_attrs = ingest_event.clickhouse_session_attrs@@ -22,7 +24,9 @@ defmodule Plausible.Ingestion.Persistor.Remote docase Req.post(persistor_url(override_url),finch: Plausible.Finch,body: encode_payload(event, session_attrs),- headers: headers+ headers: headers,+ retry: &handle_transient_error/2,+ max_retries: @max_transient_retries) do{:ok, %{status: 200, body: event_payload}} ->case decode_payload(event_payload) do@@ -48,6 +52,12 @@ defmodule Plausible.Ingestion.Persistor.Remote doendend+ defp handle_transient_error(_request, %Req.HTTPError{protocol: :http2, reason: :disconnected}) do+ true+ end++ defp handle_transient_error(_reqeust, _response), do: false+defp encode_payload(event, session_attrs) doevent_data =event