1
0
Fork 0

changes to go func

refactor/models
Matthew 2020-07-07 21:16:56 -04:00
parent 98ec12266d
commit 529a640d9e
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 12 additions and 8 deletions

View File

@ -11,6 +11,17 @@ export default async function storage(client: Client) {
return (accounts * 2) * 60000; return (accounts * 2) * 60000;
} }
let intervalTiming = await determineInterval(client); let intervalTiming = await determineInterval(client);
async function start() {
const storageDaemon = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname });
storageDaemon.stdout.on('data', (data) => client.signale.log(data.toString()));
storageDaemon.stderr.on('data', (data) => client.signale.log(data.toString()));
storageDaemon.on('exit', (code) => {
client.signale.log(`CSD-GO-STR Daemon exited with code ${code}.`);
storageDaemon.removeAllListeners();
client.signale.info(`Reactivating CSD-GO-STR daemon startup interval. Reactivating in ${intervalTiming / 60000}min.`);
});
}
/* let storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname }); /* let storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname });
storageGo.stdout.on('data', (data) => client.signale.log(data.toString())); storageGo.stdout.on('data', (data) => client.signale.log(data.toString()));
storageGo.stderr.on('data', (data) => client.signale.log(data.toString())); storageGo.stderr.on('data', (data) => client.signale.log(data.toString()));
@ -21,14 +32,7 @@ export default async function storage(client: Client) {
client.signale.info(`Activated CSD-GO-STR daemon startup interval. Starting in ${intervalTiming / 60000}min.`); client.signale.info(`Activated CSD-GO-STR daemon startup interval. Starting in ${intervalTiming / 60000}min.`);
interval = setInterval(async () => { interval = setInterval(async () => {
intervalTiming = await determineInterval(client); intervalTiming = await determineInterval(client);
const storageDaemon = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname }); await start();
storageDaemon.stdout.on('data', (data) => client.signale.log(data.toString()));
storageDaemon.stderr.on('data', (data) => client.signale.log(data.toString()));
storageDaemon.on('exit', (code) => {
client.signale.log(`CSD-GO-STR Daemon exited with code ${code}.`);
storageDaemon.removeAllListeners();
client.signale.info(`Reactivating CSD-GO-STR daemon startup interval. Reactivating in ${intervalTiming / 60000}min.`);
});
}, intervalTiming); }, intervalTiming);
} }