feat: add exit condition for allCount > 1000

This commit is contained in:
Shivam Mishra
2024-11-28 23:23:43 +05:30
parent df82f2f30b
commit 4929dad77d
@@ -13,11 +13,12 @@ export const getters = {
};
export const actions = {
get: async ({ commit }, params) => {
get: async ({ commit, state: $state }, params) => {
const currentTime = new Date();
const lastUpdatedTime = new Date(state.updatedOn);
const lastUpdatedTime = new Date($state.updatedOn);
if (currentTime - lastUpdatedTime < 10000) {
// Skip large accounts from making too many requests
if (currentTime - lastUpdatedTime < 10000 && $state.allCount > 1000) {
console.warn('Skipping conversation meta fetch');
return;
}