Attempt to move image processing to an eris-fleet service

This commit is contained in:
Essem 2021-07-05 19:20:21 -05:00
parent 736207075b
commit 97050f0cf1
No known key found for this signature in database
GPG key ID: 2502A99EDC3F6FB9
8 changed files with 302 additions and 306 deletions

View file

@ -1,21 +1,9 @@
const image = require("../../utils/image.js");
const logger = require("../../utils/logger.js");
const Command = require("../../classes/command.js");
class ImageReloadCommand extends Command {
async run() {
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload the image servers!";
await image.disconnect();
await image.repopulate();
let amount = 0;
for (const server of image.servers) {
try {
await image.connect(server);
amount += 1;
} catch (e) {
logger.error(e);
}
}
const amount = await this.ipc.command("image", { type: "reload" }, true);
if (amount > 0) {
return `Successfully connected to ${amount} image servers.`;
} else {

View file

@ -1,8 +1,8 @@
const image = require("../../utils/image.js");
const Command = require("../../classes/command.js");
class ImageStatsCommand extends Command {
async run() {
const servers = await this.ipc.command("image", { type: "stats" }, true);
const embed = {
embed: {
"author": {
@ -10,11 +10,10 @@ class ImageStatsCommand extends Command {
"icon_url": this.client.user.avatarURL
},
"color": 16711680,
"description": `The bot is currently connected to ${image.connections.size} image server(s).`,
"description": `The bot is currently connected to ${servers.length} image server(s).`,
"fields": []
}
};
const servers = await image.getRunning();
for (let i = 0; i < servers.length; i++) {
embed.embed.fields.push({
name: `Server ${i + 1}`,