diff --git a/api/api.js b/api/api.js index 45e76bc..b0bf57b 100644 --- a/api/api.js +++ b/api/api.js @@ -81,7 +81,7 @@ function encode_results(params) { function res_parser(callback){ // return a function that can be used as an HTTPS response callback - // which in turn calls the arg callback with the parsed response + // which in turn calls the arg callback with the parsed JSON body var parser = function(response) { var body = ''; var append_chunk = function(chunk) { @@ -101,9 +101,16 @@ module.exports.get_monitor_info = function(monitorId, res_cb) { monitis_get({action: 'getMonitorInfo', monitorId: monitorId},res_cb); } +var monitor_name_cache = new Object(); module.exports.get_monitors = function(tag, res_cb) { params = {action: 'getMonitors', tag: tag}; - monitis_get(params,res_cb); + var update_name_cache = function(monitors) { + for(var i=0; i