Fix stats queue

update-next
Thomas Lynch 5 months ago
parent 0552088f13
commit 5b1e386934
  1. 2
      healthcheck/worker.js
  2. 2
      redis.js
  3. 4
      stats/main.js
  4. 5
      stats/worker.js

@ -78,7 +78,7 @@ async function doCheck(domainKey, hkey, record) {
console.info('fetch()ed health:', domainKey, hkey, record.ip, recordHealth);
} else {
recordHealth = recordHealth.toString();
console.log('cached health:', domainKey, hkey, record.ip, recordHealth);
// console.log('cached health:', domainKey, hkey, record.ip, recordHealth);
}
if (recordHealth === '1') {
record.u = true;

@ -1,7 +1,7 @@
'use strict';
import dotenv from 'dotenv';
await dotenv.config({ path: '.env' });
dotenv.config({ path: '.env' });
import Redis from 'ioredis';;

@ -5,11 +5,11 @@ process
.on('unhandledRejection', console.error);
import dotenv from 'dotenv';
await dotenv.config({ path: '.env' });
dotenv.config({ path: '.env' });
import Queue from 'bull';
const haproxyStatsQueue = new Queue('stats', { w: {
const haproxyStatsQueue = new Queue('stats', { redis: {
host: process.env.REDIS_HOST || '127.0.0.1',
port: process.env.REDIS_PORT || 6379,
password: process.env.REDIS_PASS || '',

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

Loading…
Cancel
Save