Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
¿Cómo deshabilitar múltiples axios.post?
function executeStatement() { let time = global.setInterval(() => { var date = new Date(); if (date.getHours() === 14 && date.getMinutes() === 38) { console.log("What did it choose?", result_shuffle); console.log("Time", time); if (shufflearray) { var sql = `UPDATE developers SET selected = ${result_shuffle.selected} + 1 WHERE id = ${result_shuffle.id}`; db.query(sql, function (err, result) { if (err) throw err; console.log(result.affectedRows + " record(s) updated"); }); axios.post('https://hooks.slack.com/services/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', { blocks: [ { type: 'section', text: { type: 'mrkdwn', text: `Name: yo \n\n Email: sup`, }, }, ], }) } else { const abort = "abort" console.log(abort); } } }, 2000); };

Así que estoy creando una función que ejecuta un cierto valor cuando llega la marca de tiempo 14:38. Luego, este mensaje se redirige a un canal de Slack (básicamente, un bot de Slack). Todo funciona sin problemas PERO tengo un problema. El axios.post está enviando múltiples POSTS.

Así que mi canal de Slack ahora está siendo spam con Nombre: Correo electrónico: publicaciones.

¿Cómo puedo hacer que solo se publique una vez cuando llegue el momento? ¿O cómo puedo hacer que el tiempo sea más preciso para que axios.post se detenga?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede modificar su declaración if algo como esto

 if (date.getHours() === 14 && date.getMinutes() === 38 && date.getSeconds() < 2) { // .... }

Esto verificará por segundos también

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!