Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#512
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Jun 4, 2014
2 parents 6f47f4d + 8071f56 commit 31d17ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
8 changes: 6 additions & 2 deletions lib/common/config.js
Expand Up @@ -239,14 +239,16 @@ config.storePopulate = function (configuration, callback) {
flatConfig.forEach(function (cfg) {
var key = cfg[0];
var value;
if (key.indexOf('password') > -1) {
if (key.indexOf('user') > -1 && key.indexOf('password') > -1) {
value = joola.auth.hashPassword(cfg[1]);
}
else
value = cfg[1];

if (value !== null && typeof value !== 'undefined') {
var call = function (callback) {
if (typeof value === 'object')
value = '__$$__' + JSON.stringify(value);
config.redis.set('config:' + key.replace(/\./ig, ':'), value, callback);
};
calls.push(call);
Expand Down Expand Up @@ -274,7 +276,9 @@ config.localApply = function (version, callback) {
return callback(err);

key = key.replace(/:/ig, '.').replace('config.', '');
if (['true', 'false'].indexOf(value) > -1)
if (value.indexOf('__$$__') > -1)
value = JSON.parse(value.replace('__$$__', ''));
else if (['true', 'false'].indexOf(value) > -1)
value = value === 'true';

joola.common.flatGetSet(config._config, key, value);
Expand Down
2 changes: 0 additions & 2 deletions lib/common/globals.js
Expand Up @@ -131,8 +131,6 @@ joola.nodeState = function () {
lastSeenNice: new Date(),
hostname: hostname,
os: osDetails,
usageCPU: joola.lastUsage.cpu,
usageMem: joola.lastUsage.memory,
http: httpState,
https: httpsState,
cluster: isCluster,
Expand Down
21 changes: 0 additions & 21 deletions lib/common/watchers.js
Expand Up @@ -13,7 +13,6 @@
var
joola = require('../joola.io'),

usage = require('usage'),
cluster = require('cluster'),
os = require("os");

Expand Down Expand Up @@ -90,8 +89,6 @@ function node_ping() {
var ping = function () {

var node = joola.nodeState();
node['usage-cpu'] = joola.lastUsage.cpu;
node['usage-mem'] = joola.lastUsage.memory;

joola.redis.hmset(key, node, function (err) {
joola.redis.expire(key, 6);
Expand All @@ -106,23 +103,6 @@ function node_ping() {
}, 1000);
}

joola.lastUsage = {cpu: -1, memory: -1};
function watch_usage() {
var pid = process.pid;
var options = { keepHistory: true };
//drop the first one
usage.lookup(pid, options, function (err, result) {
setInterval(function () {
usage.lookup(pid, options, function (err, result) {
if (result) {
joola.lastUsage = result;
joola.common.stats({event: 'usage', cpu: result.cpu, mem: result.memory});
}
});
}, 1000);
});
}

function watch_nodes() {
/*
setInterval(function () {
Expand Down Expand Up @@ -158,7 +138,6 @@ joola.events.on('datastore:ready', function () {
watch_state();

watch_nodes();
watch_usage();
watch_roundtrip();
watch_tokens();
});
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -88,8 +88,7 @@
"stomp": "https://github.com/joola/stomp-js/tarball/master",
"traverse": "http://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz",
"twix": "~0.4.0",
"underscore": "*",
"usage": "*"
"underscore": "*"
},
"devDependencies": {
"socket.io-browserify": "*",
Expand Down

0 comments on commit 31d17ab

Please sign in to comment.