Hi Team,
We have created a freshsales suite app, in which we store each scheduler details in separate key and value pair object in local storage.
As soon as the app opened we fetch and all schedulers stored in local storage using the client.db.get method in a loop and store the fetched objects in an array and then display the scheduler details in the form of table using for loop.
But when more than 50 schedulers are created, we are facing following error. {status: 429, headers: {…}, message: ‘You have exceeded the limit of 50 requests per minute’, errorSource: ‘APP’}
async function test_fun(data){
window.bulk_tabledata_rules=[];
for(i=0;i<=100;i++){
try{
let localstore_name = "localstore"+i;
let promise = await push_data(localstore_name, data);
window.bulk_tabledata_rules.push(promise);
console.log("I'm inside for loop and after the await push_data fun in the loop", window.bulk_tabledata_rules);
}
catch(err){
console.log("after completion of await fun", window.bulk_tabledata_rules);
updateTableData_rule();
break;
}
}
}
async function push_data(ls_name, data){
return new Promise(function(resolve, reject){
client.db.get(ls_name).then(
function(data){
bulk_tabledata_rules_obj = data.bulk_auto_rules;
console.log("##### bulk_tabledata_rules_obj", bulk_tabledata_rules_obj);
resolve(bulk_tabledata_rules_obj);
})
.catch(err=>{
console.log("@@@@@@@@name not found in DB", err);
reject (err);
});
})
}
Thanks
Suman C