Skip to content
Snippets Groups Projects
Commit a7956025 authored by ForkBench's avatar ForkBench
Browse files

Updating gitignore, js -> toLowerCase and blank, Connection -> Retry if error, 3 tries

parent e04f79c6
Branches main
No related tags found
No related merge requests found
node_modules
**/*test*
src/data/config.json
src/data/projects.json
\ No newline at end of file
src/data/projects.json
# Temporary
src/code_analysis
\ No newline at end of file
......@@ -81,7 +81,7 @@ function addProjectToContainer(project, tested, vulnerable) {
<td><a href="${project.namespace.web_url}">${
project.namespace.path
}<a></td>
<td><a href="${project.web_url}">🔭</a></td>
<td><a href="${project.web_url}" target="_blank">🔭</a></td>
${
tested
? `<td><a href="/test/${project.id}">✅</a></td>`
......@@ -122,9 +122,9 @@ function filterProjects() {
// Search bar
if (
project.data.name.includes(searchBarValue) ||
project.data.description.includes(searchBarValue) ||
project.data.namespace.path.includes(searchBarValue)
project.data.name.toLowerCase().includes(searchBarValue.toLowerCase()) ||
project.data.description.toLowerCase().includes(searchBarValue.toLowerCase()) ||
project.data.namespace.path.toLowerCase().includes(searchBarValue.toLowerCase())
) {
return true;
}
......
......@@ -119,7 +119,7 @@ class Connection {
* @private
* @returns {void}
*/
recursiveFetchAllProjects(options, store) {
recursiveFetchAllProjects(options, store, tries_left=3) {
console.log(`Fetching page ${options.current_page}...`);
if (options.current_page > options.end_page) return;
......@@ -156,7 +156,23 @@ class Connection {
}
})
.catch((err) => {
throw err;
if (tries_left > 0) {
console.log("🛑 Error fetching projects, retrying...");
setTimeout(() => {
this.recursiveFetchAllProjects(
{
per_page: options.per_page,
current_page: options.current_page,
end_page: options.end_page,
display: options.display,
},
store,
tries_left - 1
);
}, 10000 + Math.random() * 10000);
} else {
throw err;
}
});
}
......@@ -200,7 +216,7 @@ class Connection {
* @private
* @returns {void}
*/
recursiveUpdateProjects(options, store) {
recursiveUpdateProjects(options, store, tries_left=3) {
console.log(`Updating page ${options.current_page}...`);
if (options.current_page > options.end_page) return;
......@@ -249,7 +265,23 @@ class Connection {
}
})
.catch((err) => {
throw err;
if (tries_left > 0) {
console.log("🛑 Error updating projects, retrying...");
setTimeout(() => {
this.recursiveUpdateProjects(
{
per_page: options.per_page,
current_page: options.current_page,
end_page: options.end_page,
display: options.display,
},
store,
tries_left - 1
);
}, 10000 + Math.random() * 10000);
} else {
throw err;
}
});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment