Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

47
Vistas
Making a clustered Node.JS app run user-created tasks every few minutes?

I'm currently using cluster with Node.js. The user will be able to send a request to the server to check on something. What I'm struggling to figure out is how to approach this.

One solution would be for the user to request the information and the server gets it for them. So every 10 minutes the user would send a request to the server. This way, it's handled automatically with express and cluster, but it's not exactly what I would prefer. I would prefer the server to have cron-like tasks that spread around the cluster.

I was thinking another solution might be to have a database with the list of user tasks to do. A cluster periodically checks the database, checks all tasks and their "last ran" time stamp, then does a task if the last ran timestamp was 10 minutes ago. I feel like there must be a cleaner solution, though.

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos