How to fix 50 requests per minute issue in Freshworks crm app

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

@Suman_Chinnaraju,
Good Day!
seems like the API limit is reached on the app due to looping,
and instead of looping, you can re-think the approach,
or if you want our help, please set up office hours with our experts.

Thanks

We had an Office Hour conversation with @Suman_Chinnaraju today.

The use-case can be very easily implemented with Entity Storage. Doing so will avoid rate limit issues as the entire loop mentioned above can be replaced by a single query, get rid of the need to serialize and deserialize data, and not be limited by the size of the serialized value that they face in K/V storage today.

However, this is a public app. Given that Entity Storage is still only available for Enterprise users, this will limit their reach. In that case, the only other option for this use case is to host the data in an external service.

@harish.janjam One more use case for you to push for Entity Storage for all plans.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.