grbsk / ng-idle

Responding to idle users in AngularJS applications.
http://hackedbychinese.github.io/ng-idle
MIT License
564 stars 195 forks source link

The 'IdleStart' is triggered when the option.idle is set too large. #207

Closed 5d closed 2 years ago

5d commented 7 years ago

In the source code, it adds a delay function with $interval and options.idle as delay interval, but it seems there is a maximum delay interval value for $interval, when the delay interval is too big, this delay function will be triggered right away.

grbsk commented 7 years ago

As far as I can tell, the the delay parameter for $interval (which is just setTimeout internally) is just a signed int32. That gives you a max delay of 2,147,483,647 milliseconds, which is nearly 25 days. BTW that setting is expressed in seconds, so the actual max value it can accept before it behaves as you described is 2147483.

Do you need an application to sit in the browser undisturbed for 25 days or more before they are considered idle?

heck4 commented 7 years ago

I encountered this issue as well. One of my developers put in 900000000 on his development machine because he got tired of being signed out. When he did so, he wasn't able to sign-in anymore. We are adding validation to the setting in our UI, but it would be nice if ng-idle did its own sanity checking. I doubt anyone needs over 25 days.

5d commented 7 years ago

Thanks for replying me, the interval with maximum 25 days is not a problem, the problem is the developer has to investigate the issue source to the library code, I agree with @heck4 , it's better to add some validations in the library.