Merge branch 'master' into empty-flush_cache-endpoint
This commit is contained in:
commit
0a994c731c
@ -11,7 +11,6 @@ env:
|
|||||||
|
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "0.8"
|
|
||||||
- "0.10"
|
- "0.10"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
@ -13,27 +13,6 @@ var affectedTableRegexCache = {
|
|||||||
|
|
||||||
module.exports = QueryTablesApi;
|
module.exports = QueryTablesApi;
|
||||||
|
|
||||||
QueryTablesApi.prototype.getLastUpdatedTime = function (username, api_key, tableNames, callback) {
|
|
||||||
var sql = 'SELECT EXTRACT(EPOCH FROM max(updated_at)) as max FROM CDB_TableMetadata m WHERE m.tabname = any (ARRAY['+
|
|
||||||
tableNames.map(function(t) { return "'" + t + "'::regclass"; }).join(',') +
|
|
||||||
'])';
|
|
||||||
|
|
||||||
// call sql api
|
|
||||||
sqlApi.query(username, api_key, sql, function(err, rows){
|
|
||||||
if (err){
|
|
||||||
var msg = err.message ? err.message : err;
|
|
||||||
callback(new Error('could not find last updated timestamp: ' + msg));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// when the table has not updated_at means it hasn't been changed so a default last_updated is set
|
|
||||||
var last_updated = 0;
|
|
||||||
if(rows.length !== 0) {
|
|
||||||
last_updated = rows[0].max || 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(null, last_updated*1000);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
QueryTablesApi.prototype.getAffectedTablesInQuery = function (username, options, sql, callback) {
|
QueryTablesApi.prototype.getAffectedTablesInQuery = function (username, options, sql, callback) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user