-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemos.threads.expressapp.js
37 lines (29 loc) · 1.1 KB
/
demos.threads.expressapp.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
/**
*
* Package: concurrency.js
* Author: Ganesh B
* Description: npm module to work with concurrency - worker threads and worker processes easily using simple functions and script files
* Install: npm i concurrency.js --save
* Github: https://github.com/ganeshkbhat/concurrency
* npmjs Link: https://www.npmjs.com/package/concurrency.js
* File: demos.threads.multiple.js
* File Description:
*
*/
/* eslint no-console: 0 */
'use strict';
const path = require("path");
let { _concurrencyThreads } = require("../index.js");
_concurrencyThreads(__filename, {
data: {
url: "https://www.google.com",
message: "Testing data"
},
childData: "Testing child data",
handlers: {
childThreadExecute: () => {
require("C:\\Users\\GB\\Documents\\projects\\allprojects\\require-urls\\concurrency\\demos\\express-app.js")
}
}
}, false, false).then((d) => console.log("Data fetched: ", JSON.stringify(d)))
.catch((e) => { console.log("Error ", JSON.stringify(e)); /* setTimeout(() => { process.exit(e); }, 5000) */ })