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

Allow disable flush on background #135

Merged
merged 2 commits into from
May 5, 2022
Merged

Conversation

jakecronin
Copy link
Contributor

Mixpanel is causing occasional terminations 30 seconds after our app enters the background due to long-running background tasks.

[BackgroundTask] Background Task 113 ("Called by Siro, from $s8Mixpanel0A8InstanceC29applicationDidEnterBackground33_0CB45E1C8B4A4433813A640264188496LLyy10Foundation12NotificationVF"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.

Adding the ability to disable flush on entering background allows us to sidestep this issue.

Future work should be done to alow Mixpanel to fail gracefully if a background task is taking too long rather than causing app to terminate.

* first commit

* fix spelling
@zihejia
Copy link
Collaborator

zihejia commented May 5, 2022

thanks @jakecronin , could you fix the android test? In the meantime, we have this PR from iOS which should be able to fix the root cause as well. We will do a release tomorrow on the iOS side.

@jakecronin
Copy link
Contributor Author

No problem @zihejia. Looks like I falsely assumed the existence of an android method.

I just pulled out the android support and added a platform check to make sure this is iOS only.

Copy link
Collaborator

@zihejia zihejia left a comment

Choose a reason for hiding this comment

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

thanks @jakecronin

@zihejia zihejia merged commit d80afe7 into mixpanel:master May 5, 2022
@zihejia zihejia added the enhancement New feature or request label May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants