LP#1775466 x-port LP#1774448 auth polling fix
authorBill Erickson <berickxx@gmail.com>
Thu, 31 May 2018 19:23:12 +0000 (15:23 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 6 Jun 2018 20:59:42 +0000 (16:59 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/core/auth.service.ts

index 6c3ef91..b660856 100644 (file)
@@ -214,7 +214,16 @@ export class EgAuthService {
 
         // add a 5 second delay to give the token plenty of time
         // to expire on the server.
-        const pollTime = this.authtime() * 1000 + 5000;
+        let pollTime = this.authtime() * 1000 + 5000;
+
+        if (pollTime < 60000) {
+            // Never poll more often than once per minute.
+            pollTime = 60000;
+        } else if (pollTime > 2147483647) {
+            // Avoid integer overflow resulting in $timeout() effectively
+            // running with timeout=0 in a loop.
+            pollTime = 2147483647;
+        }
 
         this.pollTimeout = setTimeout(() => {
             this.net.request(