clearing queue fixed master
authorebelcrom <ebelcrom@gmail.com>
Wed, 27 Jan 2021 14:53:49 +0000 (15:53 +0100)
committerebelcrom <ebelcrom@gmail.com>
Wed, 27 Jan 2021 14:53:49 +0000 (15:53 +0100)
app.js
lib/queue.js

diff --git a/app.js b/app.js
index 235763e97575a1d01cf603449422f4fe19cad309..27dbd10dbb574fceda5fb29b802fba786e479202 100644 (file)
--- a/app.js
+++ b/app.js
@@ -27,8 +27,8 @@ app.use('/' + ver, indexRouter);
 // clean at start, then at 3 am every day
 common.cleanup();
 const job = new cronJob('0 0 3 * * *', () => {
 // clean at start, then at 3 am every day
 common.cleanup();
 const job = new cronJob('0 0 3 * * *', () => {
-    common.cleanup();
-    queue.clear();
+  common.cleanup();
+  queue.clear();
 }, null, false, 'Europe/London');
 job.start();
 
 }, null, false, 'Europe/London');
 job.start();
 
index da39291e477581bfcbc467b842c34664cb47b0a2..ec6dcfd1cfbe774ee844177830d86973d9cb008f 100644 (file)
@@ -71,7 +71,9 @@ function enqueue(url) {
 }
 
 function clear() {
 }
 
 function clear() {
-  for (var i = 0; i < fifo.length; i++) {
+  const len = fifo.length;
+
+  for (var i = 0; i < len; i++) {
     fifo.pop();
   }
   map.clear();
     fifo.pop();
   }
   map.clear();