Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Setting a timer for a long period of time #80

@mustafa-hanif

Description

@mustafa-hanif

Issue

Auth.js sets a long timer like this

JWTExpiresIn = session.jwt_expires_in;
  refreshIntervalTime = this.refreshIntervalTime
      ? this.refreshIntervalTime
      : Math.max(30 * 1000, JWTExpiresIn - 45000);
  this.refreshInterval = setInterval(this._refreshToken.bind(this), refreshIntervalTime);

To which React Native complains with this message

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 https://github.com/facebook/react-native/issues/12981 for more info.
(Saw setInterval with duration 855000ms)

This is an issue referred here Timer Issue

I am not sure how to solve this, any pointers?

How to reproduce
Just use Auth to login in a managed expo or React Native project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions