|
|
@ -5,9 +5,8 @@ process |
|
|
|
.on('unhandledRejection', console.error); |
|
|
|
.on('unhandledRejection', console.error); |
|
|
|
|
|
|
|
|
|
|
|
import dotenv from 'dotenv'; |
|
|
|
import dotenv from 'dotenv'; |
|
|
|
await dotenv.config({ path: '.env' }); |
|
|
|
dotenv.config({ path: '.env' }); |
|
|
|
|
|
|
|
|
|
|
|
import * as redlock from '../redlock.js'; |
|
|
|
|
|
|
|
import Queue from 'bull'; |
|
|
|
import Queue from 'bull'; |
|
|
|
const haproxyStatsQueue = new Queue('stats', { redis: { |
|
|
|
const haproxyStatsQueue = new Queue('stats', { redis: { |
|
|
|
host: process.env.REDIS_HOST || '127.0.0.1', |
|
|
|
host: process.env.REDIS_HOST || '127.0.0.1', |
|
|
@ -97,7 +96,6 @@ async function getFormattedStats(host) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
async function processHost(host) { |
|
|
|
async function processHost(host) { |
|
|
|
console.log(host) |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const hostname = new URL(host).hostname; |
|
|
|
const hostname = new URL(host).hostname; |
|
|
|
const { frontendStats, serverStats } = await getFormattedStats(host); |
|
|
|
const { frontendStats, serverStats } = await getFormattedStats(host); |
|
|
@ -142,7 +140,6 @@ async function processHost(host) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
async function handleJob(job, done) { |
|
|
|
async function handleJob(job, done) { |
|
|
|
console.log('handleJob') |
|
|
|
|
|
|
|
const { hosts } = job.data; |
|
|
|
const { hosts } = job.data; |
|
|
|
hosts.forEach(processHost); |
|
|
|
hosts.forEach(processHost); |
|
|
|
done(); |
|
|
|
done(); |
|
|
|