App icon indicating copy to clipboard operation
App copied to clipboard

Remove SleepTimer as it is error prone and rely on Pusher instead

Open marcaaron opened this issue 5 years ago • 38 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

Normal app usage

I've been online without any changes in network status, and noticed E.cash on desktop web had the "syncing" icon. I looked and saw countless pages of this -- what is it doing?

Expected Result:

The app should only re-fetch data when necessary

Actual Result:

@quinthar noticed that the desktop app was "syncing" for no reason and saw this in the logs:

image (7)

  • These logs mean that the desktop/web app is repeatedly "polling for data" for some reason.

Workaround:

Yes, but this could create a particularly bad situation if this were to happen on mobile for a user with a large number of reports as we'd be firing off many unnecessary API requests.

Platform:

Web Desktop App

Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:

View all open jobs on Upwork

marcaaron avatar Jul 07 '21 00:07 marcaaron

Triggered auto assignment to @stephanieelliott (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

MelvinBot avatar Jul 07 '21 00:07 MelvinBot

I think we're still looking for a reproduction on this one.

marcaaron avatar Jul 07 '21 00:07 marcaaron

I noticed this on dev and turned verbose logging on. Pretty sure there is something wrong with the clock timer logic we have based on this...

Screen Shot 2021-07-07 at 10 50 05 AM

It exists to make sure we refetch reports when re-opening a laptop, but maybe there's a better way to go about it (or something has recently changed about that code - since I don't recall having this problem until now).

marcaaron avatar Jul 07 '21 20:07 marcaaron

@marcaaron are we able to repro this yet? I've tried doing it myself (unsuccessful) but not too sure what steps to follow.

stephanieelliott avatar Jul 09 '21 18:07 stephanieelliott

Nope, I've seen it pop up while working in E.cash locally - but still unsure what causes it to get into that state.

marcaaron avatar Jul 09 '21 18:07 marcaaron

OK, I'm gonna hold off on passing this through to Engineering until we can repro this.

Or rather than trying to repro ourselves, another idea could be to post reproducing the problem as a job on Upwork?

stephanieelliott avatar Jul 12 '21 19:07 stephanieelliott

We still don't really have a precedent for that as far as I know, but it's something @mallenexpensify has floated before. It would be nice to get someone working on this.

I did manage to find this Slack thread.

And this older issue that we closed that seems like the same issue.

marcaaron avatar Jul 12 '21 20:07 marcaaron

I wonder, if for issues like this, where there is an issue reproducing, if we can state at the top of the post need to be able to reproduce' and outline steps before proposing solution, then we just start it like any other issue, and double the price until someone first figures out how to reproduce and proposes a solution. Whatcha think?

mallenexpensify avatar Jul 12 '21 22:07 mallenexpensify

I like that idea @mallenexpensify! I think it could be worth at least trying. Do you think just changing the title and giving it a shout in #expensify-open-source would be the best way to start?

stephanieelliott avatar Jul 14 '21 18:07 stephanieelliott

FYI this is 100% reproducible for me: just leave E.cash open in a tab while you are doing something else, without touching it or doing anything at all, with the console open. After a few minutes the log will be full of these lines:

image

quinthar avatar Jul 14 '21 20:07 quinthar

Again: image

quinthar avatar Jul 14 '21 21:07 quinthar

So I left my chat open for a bit to see if this was happening and it did, but not with the same frequency and not in an infinite loop or anything.

Looked at the network request logs and noticed a few weird things...

  1. There are some calls to Get&returnValueList=reportStuff with an undefined value for reportIDList (doesn't seem like there is any reason to call this)
  2. We are logging to the console when there is no IOU report for a chat, but this isn't really an error.

Probably we don't need to log this. But also, why are we calling GetIOUReport for every single report? Since adding Get&returnValueList=reportSummaryList we should be able to tell if a report has an IOU report or not before calling this which seems like a good idea.

Anyways, I don't think that has anything to do with this issue.

I checked my logs and saw lots of these

66efcd6e7a9af4c4-SJC | www4.rno | 2021-07-15 03:11:16 296 | [email protected] | [info] [NetworkConnection] Firing reconnection callbacks because timer clock skewed ~~ parameter: '[]' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
66efcf0d2983f4c4-LAX | www3.lax | 2021-07-15 03:12:22 668 | [email protected] | [info] [NetworkConnection] Firing reconnection callbacks because timer clock skewed ~~ parameter: '[]' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
66efd06c795bf4c4-LAX | www4.lax | 2021-07-15 03:13:18 866 | [email protected] | [info] [NetworkConnection] Firing reconnection callbacks because timer clock skewed ~~ parameter: '[]' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'

So yes, seems like sleep timer stuff is not working correctly and the code for this is here.

marcaaron avatar Jul 15 '21 03:07 marcaaron

Sounds like we've figured out how to reproduce, I am going to move this through triage on to Engineering!

stephanieelliott avatar Jul 16 '21 19:07 stephanieelliott

Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Jul 16 '21 19:07 MelvinBot

Triggered auto assignment to @mallenexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Jul 16 '21 22:07 MelvinBot

Triggered auto assignment to @NikkiWines (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Jul 17 '21 00:07 MelvinBot

It's alive! https://www.upwork.com/jobs/~01a3f90fd52254a4ab

mallenexpensify avatar Jul 17 '21 00:07 mallenexpensify

@mallenexpensify Hi, I found this issue on upwork. The sleep timer clock is skewed even laptop is not asleep because the tab could be inactive after leaving it for a while. My proposal is to use a web worker for the sleep timer, since web workers run in another process, they will be still running when tab is inactive.

qiweiii avatar Jul 17 '21 17:07 qiweiii

@NikkiWines can you comment on @qiweiii 's post above when you have a moment?

mallenexpensify avatar Jul 19 '21 14:07 mallenexpensify

Hi @qiweiii, could you expand upon your proposal a little bit more, including some more specifics about what changes you'd be making?

NikkiWines avatar Jul 19 '21 17:07 NikkiWines