From 5b6919e0c6dd066ecad96f78f1cdac0b9f709fd0 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 30 May 2013 16:48:40 +0200 Subject: [PATCH] Fix unit of measure for lastUpdated info extraction --- lib/cartodb/server_options.js | 6 +++++- test/support/SQLAPIEmu.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index c67b134a..378bcddd 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -83,6 +83,10 @@ module.exports = function(){ }); }; + // + // Invoke callback with number of milliseconds since + // last update in any of the given tables + // me.findLastUpdated = function (username, api_key, tableNames, callback) { var sql = 'SELECT EXTRACT(EPOCH FROM max(updated_at)) as max FROM CDB_TableMetadata m WHERE m.tabname::name = any (\'{' + tableNames.join(',') + '}\')'; @@ -99,7 +103,7 @@ module.exports = function(){ if(rows.length !== 0) { last_updated = rows[0].max || 0; } - callback(null, last_updated); + callback(null, last_updated*1000); }); }; diff --git a/test/support/SQLAPIEmu.js b/test/support/SQLAPIEmu.js index cbb61b7c..99e9b8c6 100644 --- a/test/support/SQLAPIEmu.js +++ b/test/support/SQLAPIEmu.js @@ -14,7 +14,7 @@ var o = function(port, cb) { } else if ( query.q.match('EPOCH.* as max') ) { // This is the structure of the known query sent by tiler var row = { - 'max': 1234567890123 + 'max': 1234567890.123 }; res.write(JSON.stringify({rows: [ row ]})); } else {