Commit 247c3833 authored by Eriksson Monteiro's avatar Eriksson Monteiro

fix launch tangled ad module

parent 9f16436a
......@@ -11,6 +11,8 @@ import logManager from './core/log-manager';
import fs from 'fs';
import path from 'path';
import os from 'os';
const childProcess = require('child_process');
let tangledProcess;
const argv = require('yargs')
.options({
......@@ -154,13 +156,31 @@ const checkPIDFile = () => {
});
};
const checkTangledAdvertisementProcess = () => {
request.get('https://localhost:15555/', {
strictSSL: false,
encoding: null
}, (err, response, body) => {
if (err || response.statusCode !== 200) {
tangledProcess = childProcess.spawn(process.execPath, [`${__dirname}/tangled-advertisement.js`, '--pid-file', './tangled-advertisement.pid'], { stdio: 'ignore' });
}
setTimeout(() => checkTangledAdvertisementProcess(), 60000);
});
}
eventBus.on('wallet_unlock', () => {
if (!tangledProcess) {
tangledProcess = childProcess.spawn(process.execPath, [`${__dirname}/tangled-advertisement.js`, '--pid-file', './tangled-advertisement.pid'], { stdio: 'ignore' });
setTimeout(() => checkTangledAdvertisementProcess(), 60000);
}
});
logger.initialize().then(() => {
console.log('starting millix-core');
checkPIDFile()
.then(() => db.initialize())
.then(() => configLoader.cleanConfigsFromDatabase())
.then(() => configLoader.load(false))
.then(() => services.initialize())
.then(() => configLoader.load())
.then(() => services.initialize({auto_create_wallet: false}))
.then(() => {
logManager.logSize = 1000;
if (config.MODE_TEST) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment