Permalink
Browse files

fix(sync): serialise requests to the amplitude api

  • Loading branch information...
philbooth committed Jan 31, 2019
1 parent 37cacb3 commit a233401f458ac6fd26b46dc693fd324e157faf78
Showing with 4 additions and 2 deletions.
  1. +4 −2 sync-common.js
@@ -114,7 +114,9 @@ function run (dataPath, impl) {
const rows = reader.rows(PARQUET_BATCH_SIZE)
let batch = []

return Promise.all(rows.map(row => {
return rows.reduce(async (promise, row) => {
await promise

const event = createEvent(schema, row, submissionDate)
if (! event) {
eventCounts.skipped += 1
@@ -131,7 +133,7 @@ function run (dataPath, impl) {
const localBatch = batch.slice()
batch = []
return sendBatch(localBatch)
}))
}, Promise.resolve())
.then(() => {
if (batch.length > 0) {
return sendBatch(batch)

0 comments on commit a233401

Please sign in to comment.