This commit is contained in:
William Mantly 2016-05-16 16:48:56 -04:00
parent 30525c984c
commit 3b356a48f8

View File

@ -28,7 +28,7 @@ var getFreeMem = function(ip, callback){
var lxcTimeout = function(container, time){ var lxcTimeout = function(container, time){
time = time || 900000; // 15 minutes time = time || 900000; // 15 minutes
var keys = Object.keys(timeoutEvents) var keys = Object.keys(timeoutEvents);
if(keys.indexOf(container.label) !== -1){ if(keys.indexOf(container.label) !== -1){
clearTimeout(timeoutEvents[container.label]) clearTimeout(timeoutEvents[container.label])
@ -38,8 +38,7 @@ var lxcTimeout = function(container, time){
lxc.stop(name, container); lxc.stop(name, container);
return startAll(container.worker); return startAll(container.worker);
}, time); }, time);
} };
var runner = function(req, res, container){ var runner = function(req, res, container){
lxcTimeout(container); lxcTimeout(container);
@ -51,10 +50,11 @@ var runner = function(req, res, container){
}, },
body: JSON.stringify({ body: JSON.stringify({
code: req.body.code code: req.body.code
}) });
}; };
return request.post(httpOptions, function(error, response, body){ return request.post(httpOptions, function(error, response, body){
console.log('runner:', arguments)
body = JSON.parse(body); body = JSON.parse(body);
body['ip'] = container.label; body['ip'] = container.label;
return res.json(body); return res.json(body);