As a developer
I want to avoid server pausing
so that my players earnings are not freezing
Description
There is an issue with vercel and how browsers handles apps. Usually on vercel if you're inactive for more than 15 minutes on a vercel deployment, the code runtime pauses, so all my set intervals and timeouts are frozen aswell. The same thing happens if you are on mobile and turn off your screen.
So what happens, my user goes away for a day or something and if he comes back he picks up the gamestate of a day ago, he only get his Idle money applied if he manually refreshes the site.
This is the moment where we have to track user inactivity and fire hard reload events when a certain timeout is reached.
Acceptance Critera
[ ] I can close my mobile screen and after 10 minutes of inactivity my Idle Money is getting applied with a popup
[ ] I can stay away from my browser tab more than 15 minutes of inactivity and the same happens
[ ] If I stay active and keep on playing (tapping anywhere on the screen) my timeout is getting resetted on each user activity
Tasks
[ ] Write a handler which tracks user activity with window eventlisteners
[ ] Let the activity write a timestamp of last activity into the local storage in a set Interval
[ ] Read the timestamp in a setInterval and force a reload if timeout is reached
Value Proposition
As a developer I want to avoid server pausing so that my players earnings are not freezing
Description
There is an issue with vercel and how browsers handles apps. Usually on vercel if you're inactive for more than 15 minutes on a vercel deployment, the code runtime pauses, so all my set intervals and timeouts are frozen aswell. The same thing happens if you are on mobile and turn off your screen.
So what happens, my user goes away for a day or something and if he comes back he picks up the gamestate of a day ago, he only get his Idle money applied if he manually refreshes the site.
This is the moment where we have to track user inactivity and fire hard reload events when a certain timeout is reached.
Acceptance Critera
Tasks
Complexity Weight
3