@@ -1294,8 +1294,17 @@ function DateHandleKeyPress(e, searchBox) {
12941294 }
12951295}
12961296
1297- //retry count added for fetchCredentials/EDSAutoComp
1298- var retryCount = 0;
1297+ //retry counter added for fetchCredentials/EDSAutoComp
1298+ // Update retryCount in sessionStorage whenever it changes
1299+ function updateRetryCount(value) {
1300+ let retryCount = value;
1301+ eds_sessionStorage.set("retryCount", retryCount);
1302+ }
1303+
1304+ if (!(eds_sessionStorage.get("retryCount"))) {
1305+ updateRetryCount(0); // Initialize retryCount if not already set
1306+ }
1307+
12991308
13001309//function to fetch credentials before running EDSAutoComp
13011310async function fetchCredentials() {
@@ -1325,7 +1334,7 @@ async function fetchCredentials() {
13251334 "autoComp_expiry",
13261335 Math.round(Date.now() / 1000) + parseInt(creds.AuthTimeout) - 30
13271336 );
1328- retryCount = 0 ; // Reset retry count on successful fetch
1337+ updateRetryCount(0) ; // Reset retry count on successful fetch
13291338 return creds; // Return the new credentials
13301339 } else {
13311340 return creds; // Return existing credentials
@@ -1437,8 +1446,8 @@ async function EDSAutoComp() {
14371446 if (edsConfig.logerrors == "yes") {
14381447 console.log("Error in autocomplete response:", data.error);
14391448 }
1440- if (data.error && retryCount < 2) {
1441- retryCount++;
1449+ if (data.error && (eds_sessionStorage.get(" retryCount") < 2) ) {
1450+ updateRetryCount((eds_sessionStorage.get(" retryCount")) + 1); // Increment retry count
14421451 if (edsConfig.logerrors == "yes") {
14431452 console.log("Removing autoComp and autoComp_expiry due to data.error...");
14441453 console.log("Retrying fetchCredentials...");
@@ -1451,6 +1460,9 @@ async function EDSAutoComp() {
14511460 console.log("Retrying autocomplete request...");
14521461 }
14531462 jQuery("#translControl1").trigger("input");
1463+ if (edsConfig.logerrors == "yes") {
1464+ console.log("Autocomplete retriggered after refetching credentials...");
1465+ }
14541466 return;
14551467 } else {
14561468 eds_sessionStorage.remove("autoComp");
0 commit comments