таймаут фантома
This commit is contained in:
parent
b7cc799cb1
commit
40bc6eac60
4
index.js
4
index.js
@ -131,11 +131,15 @@ app.get('*', function(req, res)
|
||||
{
|
||||
let program = phantomjs.exec('phantom.js', 'http://' + config.domain + req.path)
|
||||
let body = '';
|
||||
let timeout = setTimeout(() => {
|
||||
program.kill();
|
||||
}, 45000)
|
||||
program.stderr.pipe(process.stderr)
|
||||
program.stdout.on('data', (chunk) => {
|
||||
body += chunk;
|
||||
});
|
||||
program.on('exit', code => {
|
||||
clearTimeout(timeout);
|
||||
res.header('Content-Type', 'text/html');
|
||||
res.send( body );
|
||||
})
|
||||
|
@ -3,7 +3,7 @@ function biasValuation(count, min, avrg, avrg_const)
|
||||
return ((count / (count + min)) * avrg) + ((min / (min + count)) * avrg_const);
|
||||
}
|
||||
|
||||
const rating = (good, bad) => {
|
||||
function rating(good, bad){
|
||||
if (good + bad > 0)
|
||||
{
|
||||
return biasValuation(good + bad, 9, good / (good + bad), 0.45);
|
||||
|
Loading…
Reference in New Issue
Block a user