collect_data.js
766 Bytes
'use strict';
import Collect from '../../ci/collect_data';
import {
Project
} from '../../models';
export default {
async collect(ctx) {
let projects,
servers = {};
setInterval(async() => {
if (!projects) projects = await Project.findAll();
if (!projects || !projects.length) {
return;
}
projects.forEach(async(p) => {
const hosts = p.deploy['production'].target;
hosts.forEach((host) => {
if (!servers[host]) {
servers[host] = new Collect(host, p.name);
}
servers[host].collect();
});
});
}, 5000);
}
};