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

fix: Events Queue is only paused if there were errors #78

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Next

- fix: Events Queue is only paused if there were errors ([#78](https://github.com/PostHog/posthog-android/pull/78))
- fix: Do not report flag events if the flag has been reported with the same value ([#78](https://github.com/PostHog/posthog-android/pull/78))

## 3.1.0 - 2024-01-08

- chore: Add mutations support to Session Recording ([#72](https://github.com/PostHog/posthog-android/pull/72))
Expand Down
2 changes: 1 addition & 1 deletion posthog/src/main/java/com/posthog/PostHog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public class PostHog private constructor(
if (values.contains(value)) {
shouldSendFeatureFlagEvent = false
} else {
values.add(key)
values.add(value)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not send feature flags called event twice test already exists and it was failing correctly

featureFlagsCalled[key] = values
}
}
Expand Down
6 changes: 4 additions & 2 deletions posthog/src/main/java/com/posthog/internal/PostHogQueue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ internal class PostHogQueue(
}

private fun calculateDelay(retry: Boolean) {
val delay = if (retry) min(retryCount * retryDelaySeconds, maxRetryDelaySeconds) else config.flushIntervalSeconds
pausedUntil = config.dateProvider.addSecondsToCurrentDate(delay)
if (retry) {
val delay = min(retryCount * retryDelaySeconds, maxRetryDelaySeconds)
pausedUntil = config.dateProvider.addSecondsToCurrentDate(delay)
}
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
}

fun start() {
Expand Down