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
No related branches found
No related tags found
No related merge requests found
node_modules node_modules
**/*test* **/*test*
src/data/config.json src/data/config.json
src/data/projects.json src/data/projects.json
\ No newline at end of file
# Temporary
src/code_analysis
\ No newline at end of file
...@@ -81,7 +81,7 @@ function addProjectToContainer(project, tested, vulnerable) { ...@@ -81,7 +81,7 @@ function addProjectToContainer(project, tested, vulnerable) {
<td><a href="${project.namespace.web_url}">${ <td><a href="${project.namespace.web_url}">${
project.namespace.path project.namespace.path
}<a></td> }<a></td>
<td><a href="${project.web_url}">🔭</a></td> <td><a href="${project.web_url}" target="_blank">🔭</a></td>
${ ${
tested tested
? `<td><a href="/test/${project.id}">✅</a></td>` ? `<td><a href="/test/${project.id}">✅</a></td>`
...@@ -122,9 +122,9 @@ function filterProjects() { ...@@ -122,9 +122,9 @@ function filterProjects() {
// Search bar // Search bar
if ( if (
project.data.name.includes(searchBarValue) || project.data.name.toLowerCase().includes(searchBarValue.toLowerCase()) ||
project.data.description.includes(searchBarValue) || project.data.description.toLowerCase().includes(searchBarValue.toLowerCase()) ||
project.data.namespace.path.includes(searchBarValue) project.data.namespace.path.toLowerCase().includes(searchBarValue.toLowerCase())
) { ) {
return true; return true;
} }
......
...@@ -119,7 +119,7 @@ class Connection { ...@@ -119,7 +119,7 @@ class Connection {
* @private * @private
* @returns {void} * @returns {void}
*/ */
recursiveFetchAllProjects(options, store) { recursiveFetchAllProjects(options, store, tries_left=3) {
console.log(`Fetching page ${options.current_page}...`); console.log(`Fetching page ${options.current_page}...`);
if (options.current_page > options.end_page) return; if (options.current_page > options.end_page) return;
...@@ -156,7 +156,23 @@ class Connection { ...@@ -156,7 +156,23 @@ class Connection {
} }
}) })
.catch((err) => { .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 { ...@@ -200,7 +216,7 @@ class Connection {
* @private * @private
* @returns {void} * @returns {void}
*/ */
recursiveUpdateProjects(options, store) { recursiveUpdateProjects(options, store, tries_left=3) {
console.log(`Updating page ${options.current_page}...`); console.log(`Updating page ${options.current_page}...`);
if (options.current_page > options.end_page) return; if (options.current_page > options.end_page) return;
...@@ -249,7 +265,23 @@ class Connection { ...@@ -249,7 +265,23 @@ class Connection {
} }
}) })
.catch((err) => { .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