-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathindex.js
37 lines (27 loc) · 1.08 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
global.config = require('./config')
const mongoose = require('mongoose');
const Task = require('./src/classes/Task.js');
const Seller = require('./src/models/Seller');
const Discord = require('./src/classes/Discord')
mongoose.connect(global.config.mongodb_uri, { useNewUrlParser: true, useUnifiedTopology: true });
try {
Seller.deleteMany({}, (err) => {
if (!err) {
Seller.insertMany(global.config.sites, (err) => {
if(!err){
Seller.find({}, (err, tasksQuery) => {
for (let i = 0; i < tasksQuery.length; i++) {
setTimeout(() => {
new Task(tasksQuery[i]).start();
}, 4000 * i)
}
Discord.info('Monitor successfully started, relax and stay tuned\n\nFor help open an issue on github: https://github.com/Dam998/shopify-monitor');
});
}
})
}
});
}
catch(err) {
console.log(err)
}