check for nulls

This commit is contained in:
Simon Tokumine
2012-05-08 10:38:01 +01:00
parent de4196377a
commit 13b66c4e38
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -39,7 +39,8 @@ function generateCacheChannel(req, callback){
callback(channelCache[sql_md5]);
} else{
// strip out windshaft/mapnik inserted sql
var sql = req.params.sql.match(/^\((.*)\)\sas\scdbq$/)[1];
var sql = req.params.sql.match(/^\((.*)\)\sas\scdbq$/);
sql = (sql != null) ? sql[1] : req.params.sql;
// build up api string
var sqlapi = api.protocol + '://' + username + '.' + api.host + ':' + api.port + '/api/' + api.version + '/sql'
+2 -2
View File
@@ -28,8 +28,8 @@ tests['working'] = function() { assert.ok(true); };
tests['should call purge on varnish when invalidate database'] = function() {
var varnish = new VarnishEmu(function(cmds) {
assert.ok(cmds.length == 1);
assert.equal('purge obj.http.X-Cache-Channel == test_cache\n', cmds[0]);
assert.equal('purge obj.http.X-Cache-Channel == test_db:test_cache\n', cmds[0]);
});
CacheValidator.init('localhost', 1337);
CacheValidator.invalidate_db('test_cache');
CacheValidator.invalidate_db('test_db', 'test_cache');
}