From a69a9d0d11c44d2cd4df8d279b6ed071a03e7ec4 Mon Sep 17 00:00:00 2001 From: Masum Date: Thu, 12 Oct 2017 13:56:46 +0600 Subject: [PATCH] Fix: division by zero in throughput --- export.js | 2 +- import.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/export.js b/export.js index 4912f97..c0cfac4 100644 --- a/export.js +++ b/export.js @@ -37,7 +37,7 @@ function processTableExport(table) { var startTime = Date.now(); jsonfile.on('finish', function () { var timeTaken = (Date.now() - startTime) / 1000; - var throughput = processed / timeTaken; + var throughput = timeTaken ? processed / timeTaken : 0.00; console.log('Done with table, throughput: ' + throughput.toFixed(1) + ' rows/s'); resolve(); }); diff --git a/import.js b/import.js index 71876c8..0efca88 100644 --- a/import.js +++ b/import.js @@ -109,7 +109,7 @@ function processTableImport(table) { Promise.all(queryPromises) .then(function (){ var timeTaken = (Date.now() - startTime) / 1000; - var throughput = processed / timeTaken; + var throughput = timeTaken ? processed / timeTaken : 0.00; console.log('Done with table, throughput: ' + throughput.toFixed(1) + ' rows/s'); resolve(); })