aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Churcher <[email protected]>2018-01-12 18:43:39 +1300
committerRich Churcher <[email protected]>2018-01-12 18:43:39 +1300
commit93ab6424b0e5d1899af62f7977b37625dc330cf3 (patch)
tree57001a50609363fd6a1a35b3b66fc29e51597676
parent220e5cbff3ac8bd437619c5df712bbfb8622895d (diff)
downloadfaker-93ab6424b0e5d1899af62f7977b37625dc330cf3.tar.xz
faker-93ab6424b0e5d1899af62f7977b37625dc330cf3.zip
Reset startTime appropriately
-rw-r--r--vendor/unique.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/vendor/unique.js b/vendor/unique.js
index f1f7425c..0a0e8072 100644
--- a/vendor/unique.js
+++ b/vendor/unique.js
@@ -18,7 +18,7 @@ var maxTime = 5000;
var maxRetries = 50;
// time the script started
-var startTime = new Date().getTime();
+var startTime = null;
// current iteration or retries of unique.exec ( current loop depth )
var currentIterations = 0;
@@ -41,6 +41,9 @@ unique.errorMessage = function (now, code) {
unique.exec = function (method, args, opts) {
+ if (currentIterations === 0) {
+ startTime = new Date().getTime();
+ }
var now = new Date().getTime();
opts = opts || {};
@@ -82,4 +85,4 @@ unique.exec = function (method, args, opts) {
}
};
-module.exports = unique; \ No newline at end of file
+module.exports = unique;