Browse Source

free inMemCachee on shepherd groom delete

all-modes
Petr Balashov 8 years ago
parent
commit
99885afdf0
  1. 5
      main.js
  2. 5
      routes/cache.js
  3. 2
      routes/shepherd.js

5
main.js

@ -21,7 +21,7 @@ var express = require('express'),
pm2 = require('pm2'), pm2 = require('pm2'),
cluster = require('cluster'), cluster = require('cluster'),
numCPUs = require('os').cpus().length, numCPUs = require('os').cpus().length,
coincli = require('./private/coincli.js'), //coincli = require('./private/coincli.js'),
ipc = require('electron').ipcMain; ipc = require('electron').ipcMain;
Promise = require('bluebird'); Promise = require('bluebird');
@ -41,6 +41,7 @@ var shepherd = require('./routes/shepherd'),
if (appConfig.killIguanaOnStart) { if (appConfig.killIguanaOnStart) {
var iguanaGrep; var iguanaGrep;
if (os.platform() === 'darwin') { if (os.platform() === 'darwin') {
iguanaGrep = "ps -p $(ps -A | grep -m1 iguana | awk '{print $1}') | grep -i iguana"; iguanaGrep = "ps -p $(ps -A | grep -m1 iguana | awk '{print $1}') | grep -i iguana";
} }
@ -53,7 +54,7 @@ if (appConfig.killIguanaOnStart) {
exec(iguanaGrep, function(error, stdout, stderr) { exec(iguanaGrep, function(error, stdout, stderr) {
if (stdout.indexOf('iguana') > -1) { if (stdout.indexOf('iguana') > -1) {
console.log('found another iguana process(es)'); console.log('found another iguana process(es)');
var pkillCmd = os.platform() === 'win32' ? 'taskkill /f /im iguana.exe' : 'pkill -9 iguana'; const pkillCmd = os.platform() === 'win32' ? 'taskkill /f /im iguana.exe' : 'pkill -9 iguana';
exec(pkillCmd, function(error, stdout, stderr) { exec(pkillCmd, function(error, stdout, stderr) {
console.log(pkillCmd + ' is issued'); console.log(pkillCmd + ' is issued');

5
routes/cache.js

@ -141,6 +141,8 @@ cache.groomDelete = function(req, res, next) {
if (_filename) { if (_filename) {
if (fs.existsSync(cache.iguanaDir + '/shepherd/cache-' + _filename + '.json')) { if (fs.existsSync(cache.iguanaDir + '/shepherd/cache-' + _filename + '.json')) {
inMemCache = {};
fs.unlink(cache.iguanaDir + '/shepherd/cache-' + _filename + '.json', function(err) { fs.unlink(cache.iguanaDir + '/shepherd/cache-' + _filename + '.json', function(err) {
if (err) { if (err) {
const errorObj = { const errorObj = {
@ -746,7 +748,8 @@ cache.one = function(req, res, next) {
'method': 'cache-one', 'method': 'cache-one',
'status': 'in progress', 'status': 'in progress',
'iguanaAPI': { 'iguanaAPI': {
'totalStackLength': callStack[coin] 'totalStackLength': callStack[coin],
'currentStackLength': callStack[coin]
} }
} }
} }

2
routes/shepherd.js

@ -23,7 +23,7 @@ Promise = require('bluebird');
const fixPath = require('fix-path'); const fixPath = require('fix-path');
var ps = require('ps-node'), var ps = require('ps-node'),
setconf = require('../private/setconf.js'), setconf = require('../private/setconf.js'),
coincli = require('../private/coincli.js'), //coincli = require('../private/coincli.js'),
assetChainPorts = require('./ports.js') assetChainPorts = require('./ports.js')
shepherd = express.Router(), shepherd = express.Router(),
iguanaInstanceRegistry = {}; iguanaInstanceRegistry = {};

Loading…
Cancel
Save