Made image API node chooser sort by job amount instead of CPU usage, added soundreload
This commit is contained in:
parent
55da0db479
commit
c2bd68263b
5 changed files with 70 additions and 73 deletions
|
@ -60,7 +60,8 @@ exports.getCounts = async () => {
|
|||
|
||||
exports.addCount = async (command) => {
|
||||
const count = await connection.query("SELECT * FROM counts WHERE command = $1", [command]);
|
||||
await connection.query("UPDATE counts SET count = $1 WHERE command = $2", [count.rows[0].count + 1, command]);
|
||||
if (count.rows[0].count) await connection.query("INSERT INTO counts (command, count) VALUES ($1, $2)", [command, 0]);
|
||||
await connection.query("UPDATE counts SET count = $1 WHERE command = $2", [count.rows[0].count ? count.rows[0].count + 1 : 1, command]);
|
||||
};
|
||||
|
||||
exports.addGuild = async (guild) => {
|
||||
|
|
|
@ -14,7 +14,7 @@ const formats = ["image/jpeg", "image/png", "image/webp", "image/gif"];
|
|||
const chooseServer = async (ideal) => {
|
||||
if (ideal.length === 0) throw "No available servers";
|
||||
const sorted = ideal.sort((a, b) => {
|
||||
return a.load - b.load;
|
||||
return b.load - a.load;
|
||||
});
|
||||
return sorted[0];
|
||||
};
|
||||
|
|
|
@ -44,6 +44,7 @@ exports.connect = async () => {
|
|||
this.manager.on("error", (error, node) => {
|
||||
logger.error(`An error occurred on Lavalink node ${node}: ${error}`);
|
||||
});
|
||||
return length;
|
||||
};
|
||||
|
||||
exports.play = async (sound, message, music = false) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue