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

Prefix ANDROID_LONG_TIMER_MESSAGE with "(ADVICE)" so it doesn't generate non-actionable support requests. #17083

Closed
mikelehen opened this issue Dec 5, 2017 · 2 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@mikelehen
Copy link

mikelehen commented Dec 5, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Any react native version from the last 6+ months.

Steps to Reproduce

Use Firebase in a react-native app (see the dozens of comments on #12981) or just do a setTimeout(() => { }, 60001) in an app.

Expected Behavior

Behaves as in a web browser and performs the timeout without complaint.

Actual Behavior

App displays disruptive yellow warning on the screen saying: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See #12981 for more info. (Saw setTimeout with duration 111862ms)

The Fix

Can we please please please change the warning text here to be prefixed with "(ADVICE)" so it’s no longer as disruptive?

const ANDROID_LONG_TIMER_MESSAGE =

Context:
The Firebase JavaScript SDK uses setTimeout / setInterval for a variety of tasks that need to be scheduled. For example, refreshing auth tokens, making reconnect attempts after a backoff delay, etc. This is done in the standard JavaScript way by using setInterval() or setTimeout().

React Native supports timers of any length, but currently displays a non-actionable but disruptive yellow warning if you schedule a timer for > 60 seconds.

const MAX_TIMER_DURATION_MS = 60 * 1000;

The warning references #12981 which has received a very large amount of comments, upvotes, etc., but it does not actually provide any solution. As far as I can tell, the underlying issue is a React Native one (in how it implements setTimeout / setInterval on Android) and there's nothing developers can do.

Firebase has received multiple support requests and github issues (e.g. firebase/firebase-js-sdk#97, firebase/firebase-js-sdk#283) and the comments regarding Firebase on #12981 have gathered over 100 upvotes.

We (Firebase) have no way to fix this other than reduce our timeouts which if anything will make things worse (we would need to set multiple short timeouts to get to the desired longer timeout).

From my reading of the code, warnings prefixed with "(ADVICE)" do not result in the disruptive yellow box:

if (warning.startsWith('(ADVICE)')) {

So can we please please please change the warning text here to be prefixed with "(ADVICE)" so it’s no longer as disruptive?

const ANDROID_LONG_TIMER_MESSAGE =

samsafay added a commit to samsafay/react-native that referenced this issue Jan 3, 2018
This commit is based on a suggestion made by a Firebase member facebook#17083.
Longer timers are used in critical parts of Firebase-SDK such as refreshing the token; Its a bad user experience if the token expires and users need to keep login to the application! We appreciate your cooperation.
@stale
Copy link

stale bot commented Feb 5, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 5, 2018
@stale stale bot closed this as completed Feb 12, 2018
@waqaramjad
Copy link

I face the same issue React Native performance is not good with firebase

@facebook facebook locked as resolved and limited conversation to collaborators Feb 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants