diff --git a/configuration.js b/configuration.js index bead777..59f5659 100644 --- a/configuration.js +++ b/configuration.js @@ -24,7 +24,8 @@ module.exports = function () { 'Login': ['#', '#96AA48'], 'Magister': ['http://werkman.magister.net', '#0C5489'], 'Mail': ['https://login.microsoftonline.com/', '#C41824'] - } + }, + 'spider_timeout' : 1000 } fs.writeFileSync(__dirname + '/settings.json', JSON.stringify(settings, null, 2)); //Write it to file as prettyprinted json. diff --git a/spider.js b/spider.js index c4819b0..2d0f917 100644 --- a/spider.js +++ b/spider.js @@ -88,7 +88,9 @@ function rip(data) { collection.insert(database_entry, show_output); if (studentcategory == list[list.length - 1] && student == list_students.length - 1) { - database.close(); + setTimeout(function () { + database.close(); + }, config().spider_timeout); } }