mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 13:43:06 -04:00
basecamp
This commit is contained in:
parent
ed8fa26f2c
commit
416b89c6ce
2 changed files with 25 additions and 0 deletions
10
index.js
10
index.js
|
@ -1,4 +1,5 @@
|
||||||
const { ClusterManager } = require('detritus-client');
|
const { ClusterManager } = require('detritus-client');
|
||||||
|
const { basecamp } = require('./labscore/logging');
|
||||||
|
|
||||||
const time = Date.now();
|
const time = Date.now();
|
||||||
|
|
||||||
|
@ -17,6 +18,15 @@ const manager = new ClusterManager(client, token, {
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.log(`v2 | starting v2.`)
|
console.log(`v2 | starting v2.`)
|
||||||
|
manager.on("clusterProcess", ({ clusterProcess }) => {
|
||||||
|
clusterProcess.on('close', ({code, signal}) => {
|
||||||
|
basecamp(`<:ico_w4:1086624964284788787>\`[${process.env.HOSTNAME}]\` **\` CLUSTER_CLOSED \`** Cluster ${clusterProcess.clusterId} closed with code \`${code}\` and signal \`${signal}\` @ \`${Date.now()}\``)
|
||||||
|
});
|
||||||
|
clusterProcess.on('warn', async ({error}) => {
|
||||||
|
await basecamp(`<:ico_w2:1086624961025810485>\`[${process.env.HOSTNAME}]\` **\` CLUSTER_WARNING \`** Cluster ${clusterProcess.clusterId} issued warning @ \`${Date.now()}\``)
|
||||||
|
await basecamp(`\`\`\`js\n${error}\`\`\``)
|
||||||
|
});
|
||||||
|
})
|
||||||
await manager.run();
|
await manager.run();
|
||||||
console.log(`v2 | ready. took ${(Date.now() - time) / 1000}.`)
|
console.log(`v2 | ready. took ${(Date.now() - time) / 1000}.`)
|
||||||
})();
|
})();
|
|
@ -23,4 +23,19 @@ module.exports.maintower = async function (packages, type){
|
||||||
console.log(e)
|
console.log(e)
|
||||||
throw "Maintower request failed."
|
throw "Maintower request failed."
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.basecamp = async function (log){
|
||||||
|
try{
|
||||||
|
let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp')
|
||||||
|
.set({
|
||||||
|
"Authorization": process.env.api_prod,
|
||||||
|
"x-labscore-client": "labscore/2.0"
|
||||||
|
})
|
||||||
|
.send({log})
|
||||||
|
return;
|
||||||
|
}catch(e){
|
||||||
|
console.log(e)
|
||||||
|
throw "Basecamp request failed."
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue