remove duplicate code, and fix global leak

This commit is contained in:
draco2003 2013-03-02 00:19:33 +00:00
Родитель e41aaf404e
Коммит dcf0620da1
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -110,8 +110,6 @@ var flush_stats = function graphite_flush(ts, metrics) {
} }
for (key in timer_data) { for (key in timer_data) {
var namespace = timerNamespace.concat(key);
var the_key = namespace.join(".");
for (timer_data_key in timer_data[key]) { for (timer_data_key in timer_data[key]) {
var namespace = timerNamespace.concat(key); var namespace = timerNamespace.concat(key);
var the_key = namespace.join("."); var the_key = namespace.join(".");
@ -119,7 +117,7 @@ var flush_stats = function graphite_flush(ts, metrics) {
if (typeof(timer_data[key][timer_data_key]) === 'number') { if (typeof(timer_data[key][timer_data_key]) === 'number') {
statString += the_key + '.' + timer_data_key + ' ' + timer_data[key][timer_data_key] + ts_suffix; statString += the_key + '.' + timer_data_key + ' ' + timer_data[key][timer_data_key] + ts_suffix;
} else { } else {
for (timer_data_sub_key in timer_data[key][timer_data_key]) { for (var timer_data_sub_key in timer_data[key][timer_data_key]) {
l.log(timer_data[key][timer_data_key][timer_data_sub_key].toString()); l.log(timer_data[key][timer_data_key][timer_data_sub_key].toString());
statString += the_key + '.' + timer_data_key + '.' + timer_data_sub_key + ' ' + statString += the_key + '.' + timer_data_key + '.' + timer_data_sub_key + ' ' +
timer_data[key][timer_data_key][timer_data_sub_key] + ts_suffix; timer_data[key][timer_data_key][timer_data_sub_key] + ts_suffix;