Skip to content

Commit

Permalink
Merge pull request #67 from Arquisoft/prueba
Browse files Browse the repository at this point in the history
  • Loading branch information
bidof authored Mar 11, 2024
2 parents 75a5a89 + 953350d commit 5afeb0a
Show file tree
Hide file tree
Showing 12 changed files with 335 additions and 144 deletions.
187 changes: 187 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"dependencies": {
"@mui/system": "^5.15.12",
"bootstrap": "^5.3.3",
"cron": "^3.1.6",
"dotenv": "^16.4.5",
"mysql": "^2.18.1",
"mysql2": "^3.9.2",
"node-cron": "^3.0.3",
"react-bootstrap": "^2.10.1"
"react-bootstrap": "^2.10.1",
"react-router-dom": "^6.22.3"
}
}
19 changes: 16 additions & 3 deletions questionservice/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@ class Scheduler {
console.error(error);
}
}

start() {
cron.schedule('*/30 * * * *', async () => {
cron.schedule('*/15 * * * *', async () => {

try {
await this.addQuestion();
} catch (error) {
console.error('Failed to add question:', error);
// Aquí podrías implementar una lógica para manejar el error, como reintentar después de un tiempo,
// enviar una alerta, etc.
}


/* version con errores
this.success = false;
while (!this.success) {
this.addQuestion();
//ojo como es asincrono si no lo pones el bucle se sigue ejecutando y petas la pila de javasycrpit y cae el contendor
await this.addQuestion();
}
*/
});
}
}
Expand Down
26 changes: 13 additions & 13 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react": "^18.2.0",
"react-bootstrap": "^2.10.1",
"react-dom": "^18.2.0",
"react-router-dom": "^6.1.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"web-vitals": "^3.5.1"
},
Expand Down
Loading

0 comments on commit 5afeb0a

Please sign in to comment.