make arguments handling for packworker more robust

This commit is contained in:
Brian Gough 2017-05-09 11:33:21 +01:00
parent cac7556ad5
commit c26bccd390
2 changed files with 2 additions and 2 deletions

View file

@ -61,7 +61,7 @@ app.post "/pack", (req, res, next) ->
else
logger.log "running pack"
packWorker = child_process.fork(__dirname + '/app/js/PackWorker.js',
[req.query.limit, req.query.delay, req.query.timeout])
[req.query.limit || 1000, req.query.delay || 1000, req.query.timeout || 30*60*1000])
packWorker.on 'exit', (code, signal) ->
logger.log {code, signal}, "history auto pack exited"
packWorker = null

View file

@ -22,7 +22,7 @@ source = process.argv[2]
DOCUMENT_PACK_DELAY = Number(process.argv[3]) || 1000
TIMEOUT = Number(process.argv[4]) || 30*60*1000
if source.match(/[^0-9]/)
if !source.match(/^[0-9]+$/)
file = fs.readFileSync source
result = for line in file.toString().split('\n')
[project_id, doc_id] = line.split(' ')