summaryrefslogtreecommitdiff
path: root/worker.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-07 23:52:11 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-07 23:52:11 +0200
commitcf3e9b680a315dfac5ff8571799ba700754dbe2d (patch)
tree1bd1619ab6aaec6007a86492938363d0ace57a1b /worker.js
parent78f4b0cc54f1a877f4e53f1a21b01f8c2791c9d1 (diff)
downloadprocessor-cf3e9b680a315dfac5ff8571799ba700754dbe2d.tar.gz
processor-cf3e9b680a315dfac5ff8571799ba700754dbe2d.zip
attempt to fix race condition
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/worker.js b/worker.js
index 1772db6..1b72e36 100644
--- a/worker.js
+++ b/worker.js
@@ -55,7 +55,7 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI,
// fill queue until batchsize or idle
if (timer === undefined)
- timer = setTimeout(process, IDLE_TIMEOUT)
+ timer = setTimeout(process, IDLE_TIMEOUT);
if (queue.length == BATCHSIZE)
await process();
}, { noAck: false });
@@ -212,8 +212,8 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI,
try {
console.log("inserting batch into db");
// upsert whole batch in parallel
- await seq.transaction({ autocommit: false }, (transaction) => {
- return Promise.all([
+ await seq.transaction({ autocommit: false }, async (transaction) => {
+ await Promise.all([
model.Match.bulkCreate(match_records, {
include: [ model.Roster, model.Asset ],
updateOnDuplicate: [], // all