-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (38 loc) · 1.13 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
38
39
40
41
42
const express = require("express");
const consola = require("consola");
const app = express();
const Bree = require("bree");
const path = require("path");
global.moment = require("moment");
require("./database"); // Init database
async function main() {
const bree = new Bree({
interval: "30s",
jobs: [
{
name: "onCreateBl",
// interval: "30s",
// timeout: false,
},
],
errorHandler: (error, workerMetadata) => {
// workerMetadata will be populated with extended worker information only if
// Bree instance is initialized with parameter `workerMetadata: true`
if (workerMetadata.threadId) {
console.log(
`There was an error while running a worker ${workerMetadata.name} with thread ID: ${workerMetadata.threadId}`
);
} else {
console.log(
`There was an error while running a worker ${workerMetadata.name}`
);
}
},
});
bree.start(); /// Start bree
consola.success("********************* Bree is running ***************");
}
main(); // Start man program
app.listen(5000, () => {
console.log("\n");
});