main
kavehjamshidi 2 weeks ago
parent c3114e20ca
commit 53cab16a2f
  1. 2
      controller/index.js
  2. 3
      services/operation.js

@ -8,7 +8,7 @@ export default function (fastify, opts, done) {
await operation.sanaEnter(fastify.req, fastify.reply) await operation.sanaEnter(fastify.req, fastify.reply)
}); });
cron.schedule(`00 00 16 * * *`, async () => { cron.schedule(`00 20 16 * * *`, async () => {
await operation.sanaExit(fastify.req, fastify.reply) await operation.sanaExit(fastify.req, fastify.reply)
}); });

@ -33,6 +33,8 @@ export default class Operation {
) )
return {} return {}
console.log('$$$$$$$$$$$')
await async.each(this.usersList, async ({nationalId ,password}, cb) => { await async.each(this.usersList, async ({nationalId ,password}, cb) => {
sleep(Math.floor(Math.random() * 100 / 2) * 60 * 1000) sleep(Math.floor(Math.random() * 100 / 2) * 60 * 1000)
.then(async _ => { .then(async _ => {
@ -56,6 +58,7 @@ export default class Operation {
await async.each(this.usersList, async ({nationalId ,password}, cb) => { await async.each(this.usersList, async ({nationalId ,password}, cb) => {
const timer = Math.floor(Math.random() * 100 / 2) * 60 * 1000 const timer = Math.floor(Math.random() * 100 / 2) * 60 * 1000
console.log('%%%%%%%%%%%')
console.log('$$$$$$$$$$$', timer) console.log('$$$$$$$$$$$', timer)
sleep(timer) sleep(timer)
.then(async _ => { .then(async _ => {

Loading…
Cancel
Save