From d028285b1c2a0fbdc6ce75c82229690986fc078d Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Thu, 10 Sep 2026 14:27:23 -0400 Subject: [PATCH 1/3] chore(config): deprecate maxRetries --- .changeset/deprecate-max-retries.md | 5 +++++ posthog/src/main/java/com/posthog/PostHogConfig.kt | 9 ++++++++- .../posthog/internal/PostHogPushSubscriptionManager.kt | 1 + .../src/test/java/com/posthog/internal/PostHogApiTest.kt | 1 + .../internal/PostHogPushSubscriptionManagerTest.kt | 1 + .../com/posthog/internal/PostHogQueueDurabilityTest.kt | 1 + .../test/java/com/posthog/internal/PostHogQueueTest.kt | 1 + 7 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .changeset/deprecate-max-retries.md diff --git a/.changeset/deprecate-max-retries.md b/.changeset/deprecate-max-retries.md new file mode 100644 index 000000000..5be5bbf71 --- /dev/null +++ b/.changeset/deprecate-max-retries.md @@ -0,0 +1,5 @@ +--- +"posthog": minor +--- + +Deprecate `maxRetries` with a warning. Ingestion retries are not count-limited. Use `maxQueueSize` for events and replay, and `logs.maxBufferSize` for logs. This option still controls push subscription registration retries. diff --git a/posthog/src/main/java/com/posthog/PostHogConfig.kt b/posthog/src/main/java/com/posthog/PostHogConfig.kt index 716274b68..809a25d7a 100644 --- a/posthog/src/main/java/com/posthog/PostHogConfig.kt +++ b/posthog/src/main/java/com/posthog/PostHogConfig.kt @@ -126,9 +126,16 @@ public open class PostHogConfig( public var maxBatchSize: Int = DEFAULT_MAX_BATCH_SIZE, /** * Maximum number of retries for push subscription registration failures. - * Durable ingestion queues retain retryable records and are bounded by their queue size. + * Ingestion retries are not count-limited. Use [maxQueueSize] for events and replay, + * and [PostHogLogsConfig.maxBufferSize] for logs. This option still controls push subscription registration retries. * Defaults to 3 */ + @Deprecated( + message = + "Ingestion retries are not count-limited. Use maxQueueSize for events and replay, " + + "and logs.maxBufferSize for logs. This option still controls push subscription registration retries.", + level = DeprecationLevel.WARNING, + ) public var maxRetries: Int = 3, /** * Maximum number of retries for feature flag requests after transient network errors. diff --git a/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt b/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt index ece08364c..f8e8e89e0 100644 --- a/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt +++ b/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt @@ -603,6 +603,7 @@ internal class PostHogPushSubscriptionManager( } retryCount++ + @Suppress("DEPRECATION") if (retryCount > config.maxRetries) { config.logger.log( "Push subscription retries exhausted after $retryCount attempts; " + diff --git a/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt index ff7aa1f89..1d543f25d 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt @@ -63,6 +63,7 @@ internal class PostHogApiTest { config.httpClient = httpClient } if (maxRetries != null) { + @Suppress("DEPRECATION") config.maxRetries = maxRetries } if (featureFlagRequestMaxRetries != null) { diff --git a/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt index 87ee9393c..66dad5621 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt @@ -52,6 +52,7 @@ internal class PostHogPushSubscriptionManagerTest { PostHogConfig(API_KEY, host = http.url("/").toString()).apply { this.storagePrefix = storagePrefix this.networkStatus = networkStatus + @Suppress("DEPRECATION") this.maxRetries = maxRetries this.encryption = encryption } diff --git a/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt index a96f5d446..19fd918bc 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt @@ -47,6 +47,7 @@ internal class PostHogQueueDurabilityTest { maxQueueSize = capacity maxBatchSize = batchSize flushAt = 100 + @Suppress("DEPRECATION") maxRetries = 2 dateProvider = clock this.networkStatus = networkStatus diff --git a/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt index 27df4188a..fba77edab 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt @@ -55,6 +55,7 @@ internal class PostHogQueueTest { this.networkStatus = networkStatus this.maxBatchSize = maxBatchSize this.dateProvider = dateProvider + @Suppress("DEPRECATION") this.maxRetries = maxRetries this.httpClient = httpClient } From 3a2885f3079d9e1be4102a6de347db27b8cbae81 Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Thu, 10 Sep 2026 14:50:19 -0400 Subject: [PATCH 2/3] docs(config): clarify maxRetries scope --- .changeset/clarify-max-retries-scope.md | 5 +++++ .changeset/deprecate-max-retries.md | 5 ----- posthog/src/main/java/com/posthog/PostHogConfig.kt | 13 +++++-------- .../internal/PostHogPushSubscriptionManager.kt | 1 - .../java/com/posthog/internal/PostHogApiTest.kt | 1 - .../internal/PostHogPushSubscriptionManagerTest.kt | 1 - .../posthog/internal/PostHogQueueDurabilityTest.kt | 1 - .../java/com/posthog/internal/PostHogQueueTest.kt | 1 - 8 files changed, 10 insertions(+), 18 deletions(-) create mode 100644 .changeset/clarify-max-retries-scope.md delete mode 100644 .changeset/deprecate-max-retries.md diff --git a/.changeset/clarify-max-retries-scope.md b/.changeset/clarify-max-retries-scope.md new file mode 100644 index 000000000..1f5f9ceda --- /dev/null +++ b/.changeset/clarify-max-retries-scope.md @@ -0,0 +1,5 @@ +--- +"posthog": patch +--- + +Clarify that `maxRetries` limits push-subscription registration retries. Retryable event, replay, and log ingestion failures retain queued records for later flush attempts with backoff. Use `maxQueueSize` for event/replay capacity and `logs.maxBufferSize` for log capacity. diff --git a/.changeset/deprecate-max-retries.md b/.changeset/deprecate-max-retries.md deleted file mode 100644 index 5be5bbf71..000000000 --- a/.changeset/deprecate-max-retries.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"posthog": minor ---- - -Deprecate `maxRetries` with a warning. Ingestion retries are not count-limited. Use `maxQueueSize` for events and replay, and `logs.maxBufferSize` for logs. This option still controls push subscription registration retries. diff --git a/posthog/src/main/java/com/posthog/PostHogConfig.kt b/posthog/src/main/java/com/posthog/PostHogConfig.kt index 809a25d7a..1922a2306 100644 --- a/posthog/src/main/java/com/posthog/PostHogConfig.kt +++ b/posthog/src/main/java/com/posthog/PostHogConfig.kt @@ -126,16 +126,13 @@ public open class PostHogConfig( public var maxBatchSize: Int = DEFAULT_MAX_BATCH_SIZE, /** * Maximum number of retries for push subscription registration failures. - * Ingestion retries are not count-limited. Use [maxQueueSize] for events and replay, - * and [PostHogLogsConfig.maxBufferSize] for logs. This option still controls push subscription registration retries. + * + * This limit does not apply to event, replay, or log ingestion. Retryable ingestion + * failures retain queued records for later flush triggers, subject to backoff. + * Use [maxQueueSize] for events and replay, and [PostHogLogsConfig.maxBufferSize] for logs. + * * Defaults to 3 */ - @Deprecated( - message = - "Ingestion retries are not count-limited. Use maxQueueSize for events and replay, " + - "and logs.maxBufferSize for logs. This option still controls push subscription registration retries.", - level = DeprecationLevel.WARNING, - ) public var maxRetries: Int = 3, /** * Maximum number of retries for feature flag requests after transient network errors. diff --git a/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt b/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt index f8e8e89e0..ece08364c 100644 --- a/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt +++ b/posthog/src/main/java/com/posthog/internal/PostHogPushSubscriptionManager.kt @@ -603,7 +603,6 @@ internal class PostHogPushSubscriptionManager( } retryCount++ - @Suppress("DEPRECATION") if (retryCount > config.maxRetries) { config.logger.log( "Push subscription retries exhausted after $retryCount attempts; " + diff --git a/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt index 1d543f25d..ff7aa1f89 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogApiTest.kt @@ -63,7 +63,6 @@ internal class PostHogApiTest { config.httpClient = httpClient } if (maxRetries != null) { - @Suppress("DEPRECATION") config.maxRetries = maxRetries } if (featureFlagRequestMaxRetries != null) { diff --git a/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt index 66dad5621..87ee9393c 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogPushSubscriptionManagerTest.kt @@ -52,7 +52,6 @@ internal class PostHogPushSubscriptionManagerTest { PostHogConfig(API_KEY, host = http.url("/").toString()).apply { this.storagePrefix = storagePrefix this.networkStatus = networkStatus - @Suppress("DEPRECATION") this.maxRetries = maxRetries this.encryption = encryption } diff --git a/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt index 19fd918bc..a96f5d446 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogQueueDurabilityTest.kt @@ -47,7 +47,6 @@ internal class PostHogQueueDurabilityTest { maxQueueSize = capacity maxBatchSize = batchSize flushAt = 100 - @Suppress("DEPRECATION") maxRetries = 2 dateProvider = clock this.networkStatus = networkStatus diff --git a/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt b/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt index fba77edab..27df4188a 100644 --- a/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt +++ b/posthog/src/test/java/com/posthog/internal/PostHogQueueTest.kt @@ -55,7 +55,6 @@ internal class PostHogQueueTest { this.networkStatus = networkStatus this.maxBatchSize = maxBatchSize this.dateProvider = dateProvider - @Suppress("DEPRECATION") this.maxRetries = maxRetries this.httpClient = httpClient } From b47d6a1a3ca8fd5d4341e0a3aef54b95a5776c2f Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Thu, 10 Sep 2026 15:04:08 -0400 Subject: [PATCH 3/3] docs: use the durable queue changeset --- .changeset/clarify-max-retries-scope.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/clarify-max-retries-scope.md diff --git a/.changeset/clarify-max-retries-scope.md b/.changeset/clarify-max-retries-scope.md deleted file mode 100644 index 1f5f9ceda..000000000 --- a/.changeset/clarify-max-retries-scope.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"posthog": patch ---- - -Clarify that `maxRetries` limits push-subscription registration retries. Retryable event, replay, and log ingestion failures retain queued records for later flush attempts with backoff. Use `maxQueueSize` for event/replay capacity and `logs.maxBufferSize` for log capacity.