Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App completa entregable 1 #67

Merged
merged 8 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading