Skip to content

Commit

Permalink
Retry in macro cluster in another way
Browse files Browse the repository at this point in the history
  • Loading branch information
ujh committed Jan 5, 2025
1 parent 277bbf4 commit bbd770d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/javascript/src/admin/micro-clusters/macroClusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ export const updateMacroCluster = (id, dispatch) => {
}, 500);
};

const loadMacroClusterPage = async (page) => {
const response = await getRequest(
`/admins/macro_clusters.json?per_page=25&page=${page}`,
10 // timeout after 10s
);
return await response.json();
const loadMacroClusterPage = async (page, count = 0) => {
try {
const response = await getRequest(
`/admins/macro_clusters.json?per_page=25&page=${page}`,
10 // timeout after 10s
);
return await response.json();
} catch (e) {
if (count > 3) {
throw e;
}
loadMacroClusterPage(page, count + 1);
}
};

0 comments on commit bbd770d

Please sign in to comment.