X-Git-Url: http://git.pjr.cc/?p=nodejs-repoproxy.git;a=blobdiff_plain;f=lib%2Frouter.js;fp=lib%2Frouter.js;h=626eb5dd35703f7c74ea0de328dffe908a08f855;hp=8a7dca251eb82398749e9e10a27e69b27afc5cb2;hb=3fa5e831263792a76c9430b9d86e353901bc4477;hpb=68fbf923faf99f86cc36dc5776451f89925df8bd diff --git a/lib/router.js b/lib/router.js index 8a7dca2..626eb5d 100644 --- a/lib/router.js +++ b/lib/router.js @@ -10,7 +10,9 @@ exports.routeRequest = function(req, res) { unified.b.writeHead(404, {"Content-Type": "text/plain"}); unified.b.write("404 Not Found\n"); } else if(unified.exists) { - if(unified.isFile) { + if(typeof global.repoproxy.downloads[unified.fullFilePath] != "undefined" && global.repoproxy.downloads[unified.fullFilePath] == 1) { + cache.upstreamRequest(unified); + } else if(unified.isFile) { cache.serviceFile(unified); } else if(unified.isDirectory) { cache.serviceDirectory(unified); @@ -20,11 +22,7 @@ exports.routeRequest = function(req, res) { } else { // it doesnt exist yet, so we send it to the cache service console.log("file doesnt exist, upstream we go: ", unified); - cache.upstreamRequest(unified, function(err) { - if(err == null) { - cache.watchAndService(unfied); - } // if upstream sends anything other then a 200, cache.upstreamRequest will handle it (i.e. 302, 404, etc) - }); + cache.upstreamRequest(unified); } }); }