From e938dedc4ff96ac25ab4900fb0e865af812050ff Mon Sep 17 00:00:00 2001 From: oleg Date: Thu, 19 Nov 2015 20:20:35 +0300 Subject: [PATCH] put all lines by signle query --- distributor.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/distributor.js b/distributor.js index 39cf153..810a090 100644 --- a/distributor.js +++ b/distributor.js @@ -136,20 +136,19 @@ exports.init = function(app, callback) { {lines: lines} ); - // write build logs to db _(lines).each(function(line) { - db.logLines.put(_({ - buildId: build.id, - }).extend(line), function(err) { - if (err) { - logger.error( - 'Error during write log line "' + logLineNumber + - '" for build "' + build.id + '":', - err.stack || err - ); - } - }); - }) + line.buildId = build.id; + }); + // write build logs to db + db.logLines.put(lines, function(err) { + if (err) { + logger.error( + 'Error during write log line "' + logLineNumber + + '" for build "' + build.id + '":', + err.stack || err + ); + } + }); }); callback(null, distributor);