@nexrender/worker 1.49.4 → 1.49.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.js +17 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrender/worker",
|
|
3
|
-
"version": "1.49.
|
|
3
|
+
"version": "1.49.5",
|
|
4
4
|
"author": "inlife",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"homepage": "https://www.nexrender.com",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d72ac62e6b133359768dab517235204d1e99ca3b"
|
|
33
33
|
}
|
package/src/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const NEXRENDER_API_POLLING = process.env.NEXRENDER_API_POLLING || 30 * 1000;
|
|
|
7
7
|
const NEXRENDER_TOLERATE_EMPTY_QUEUES = process.env.NEXRENDER_TOLERATE_EMPTY_QUEUES;
|
|
8
8
|
var emptyReturns = 0;
|
|
9
9
|
|
|
10
|
-
/* TODO: possibly add support for graceful shutdown */
|
|
11
10
|
let active = true;
|
|
12
11
|
|
|
13
12
|
const delay = amount => (
|
|
@@ -175,4 +174,20 @@ const start = async (host, secret, settings, headers) => {
|
|
|
175
174
|
} while (active)
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Stops worker "thread"
|
|
179
|
+
* @return {void}
|
|
180
|
+
*/
|
|
181
|
+
const stop = () => {
|
|
182
|
+
active = false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Returns the current status of the worker
|
|
187
|
+
* @return {Boolean}
|
|
188
|
+
*/
|
|
189
|
+
const isRunning = () => {
|
|
190
|
+
return active;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
module.exports = { start, stop, isRunning }
|